From 8b80dd2d846e2927d7dac2721216bcf3273cf635 Mon Sep 17 00:00:00 2001 From: Seokhee Lee Date: Thu, 22 Dec 2022 12:37:29 +0900 Subject: [PATCH] Update Commands.h based on the latest version in upstream --- .../zap-generated/cluster/Commands.h | 199346 ++++++++------- 1 file changed, 108656 insertions(+), 90690 deletions(-) diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index af2df1ea0524a5..b1a39e784e77ad 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -105,8 +105,8 @@ | AccountLogin | 0x050E | | ElectricalMeasurement | 0x0B04 | | ClientMonitoring | 0x1046 | -| UnitTesting | 0xFFF1FC05| -| FaultInjection | 0xFFF1FC06| +| UnitTesting | +0xFFF1FC05| | FaultInjection | 0xFFF1FC06| \*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*\ @@ -133,43 +133,52 @@ */ class IdentifyIdentify : public ClusterCommand { public: - IdentifyIdentify() - : ClusterCommand("identify") - { - AddArgument("IdentifyTime", 0, UINT16_MAX, &mRequest.identifyTime); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.identifyTime = [NSNumber numberWithUnsignedShort:mRequest.identifyTime]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster identifyWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + IdentifyIdentify() : ClusterCommand("identify") { + AddArgument("IdentifyTime", 0, UINT16_MAX, &mRequest.identifyTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000003) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRIdentifyClusterIdentifyParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.identifyTime = + [NSNumber numberWithUnsignedShort:mRequest.identifyTime]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster identifyWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Identify::Commands::Identify::Type mRequest; + chip::app::Clusters::Identify::Commands::Identify::Type mRequest; }; /* @@ -177,45 +186,55 @@ class IdentifyIdentify : public ClusterCommand { */ class IdentifyTriggerEffect : public ClusterCommand { public: - IdentifyTriggerEffect() - : ClusterCommand("trigger-effect") - { - AddArgument("EffectIdentifier", 0, UINT8_MAX, &mRequest.effectIdentifier); - AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) command (0x00000040) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectIdentifier)]; - params.effectVariant = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + IdentifyTriggerEffect() : ClusterCommand("trigger-effect") { + AddArgument("EffectIdentifier", 0, UINT8_MAX, &mRequest.effectIdentifier); + AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000003) command (0x00000040) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.effectIdentifier = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.effectIdentifier)]; + params.effectVariant = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster triggerEffectWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Identify::Commands::TriggerEffect::Type mRequest; + chip::app::Clusters::Identify::Commands::TriggerEffect::Type mRequest; }; /* @@ -223,103 +242,129 @@ class IdentifyTriggerEffect : public ClusterCommand { */ class ReadIdentifyIdentifyTime : public ReadAttribute { public: - ReadIdentifyIdentifyTime() - : ReadAttribute("identify-time") - { - } - - ~ReadIdentifyIdentifyTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.IdentifyTime response %@", [value description]); - if (error != nil) { - LogNSError("Identify IdentifyTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIdentifyIdentifyTime() : ReadAttribute("identify-time") {} + + ~ReadIdentifyIdentifyTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeIdentifyTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.IdentifyTime response %@", [value description]); + if (error != nil) { + LogNSError("Identify IdentifyTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteIdentifyIdentifyTime : public WriteAttribute { public: - WriteIdentifyIdentifyTime() - : WriteAttribute("identify-time") - { - AddArgument("attr-name", "identify-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteIdentifyIdentifyTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeIdentifyTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Identify IdentifyTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteIdentifyIdentifyTime() : WriteAttribute("identify-time") { + AddArgument("attr-name", "identify-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteIdentifyIdentifyTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeIdentifyTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Identify IdentifyTime write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeIdentifyIdentifyTime : public SubscribeAttribute { public: - SubscribeAttributeIdentifyIdentifyTime() - : SubscribeAttribute("identify-time") - { - } + SubscribeAttributeIdentifyIdentifyTime() + : SubscribeAttribute("identify-time") {} - ~SubscribeAttributeIdentifyIdentifyTime() {} + ~SubscribeAttributeIdentifyIdentifyTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeIdentifyTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeIdentifyTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.IdentifyTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.IdentifyTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -327,65 +372,77 @@ class SubscribeAttributeIdentifyIdentifyTime : public SubscribeAttribute { */ class ReadIdentifyIdentifyType : public ReadAttribute { public: - ReadIdentifyIdentifyType() - : ReadAttribute("identify-type") - { - } - - ~ReadIdentifyIdentifyType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.IdentifyType response %@", [value description]); - if (error != nil) { - LogNSError("Identify IdentifyType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIdentifyIdentifyType() : ReadAttribute("identify-type") {} + + ~ReadIdentifyIdentifyType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeIdentifyTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.IdentifyType response %@", [value description]); + if (error != nil) { + LogNSError("Identify IdentifyType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeIdentifyIdentifyType : public SubscribeAttribute { public: - SubscribeAttributeIdentifyIdentifyType() - : SubscribeAttribute("identify-type") - { - } + SubscribeAttributeIdentifyIdentifyType() + : SubscribeAttribute("identify-type") {} - ~SubscribeAttributeIdentifyIdentifyType() {} + ~SubscribeAttributeIdentifyIdentifyType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeIdentifyTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeIdentifyTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.IdentifyType response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.IdentifyType response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -393,65 +450,80 @@ class SubscribeAttributeIdentifyIdentifyType : public SubscribeAttribute { */ class ReadIdentifyGeneratedCommandList : public ReadAttribute { public: - ReadIdentifyGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadIdentifyGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Identify GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIdentifyGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeIdentifyGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeIdentifyGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadIdentifyGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadIdentifyGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Identify GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIdentifyGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeIdentifyGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeIdentifyGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -459,65 +531,79 @@ class SubscribeAttributeIdentifyGeneratedCommandList : public SubscribeAttribute */ class ReadIdentifyAcceptedCommandList : public ReadAttribute { public: - ReadIdentifyAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadIdentifyAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Identify AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIdentifyAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeIdentifyAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeIdentifyAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadIdentifyAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadIdentifyAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Identify AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIdentifyAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeIdentifyAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeIdentifyAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -525,65 +611,77 @@ class SubscribeAttributeIdentifyAcceptedCommandList : public SubscribeAttribute */ class ReadIdentifyAttributeList : public ReadAttribute { public: - ReadIdentifyAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadIdentifyAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Identify AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIdentifyAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadIdentifyAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Identify AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeIdentifyAttributeList : public SubscribeAttribute { public: - SubscribeAttributeIdentifyAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeIdentifyAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeIdentifyAttributeList() {} + ~SubscribeAttributeIdentifyAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -591,65 +689,76 @@ class SubscribeAttributeIdentifyAttributeList : public SubscribeAttribute { */ class ReadIdentifyFeatureMap : public ReadAttribute { public: - ReadIdentifyFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadIdentifyFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Identify FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIdentifyFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadIdentifyFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Identify.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Identify FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeIdentifyFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeIdentifyFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeIdentifyFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeIdentifyFeatureMap() {} + ~SubscribeAttributeIdentifyFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -657,65 +766,77 @@ class SubscribeAttributeIdentifyFeatureMap : public SubscribeAttribute { */ class ReadIdentifyClusterRevision : public ReadAttribute { public: - ReadIdentifyClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadIdentifyClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Identify ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIdentifyClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadIdentifyClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Identify ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeIdentifyClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeIdentifyClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeIdentifyClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeIdentifyClusterRevision() {} + ~SubscribeAttributeIdentifyClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000003) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000003) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterIdentify alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Identify.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Identify.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -745,48 +866,59 @@ class SubscribeAttributeIdentifyClusterRevision : public SubscribeAttribute { */ class GroupsAddGroup : public ClusterCommand { public: - GroupsAddGroup() - : ClusterCommand("add-group") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("GroupName", &mRequest.groupName); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() - length:mRequest.groupName.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster addGroupWithParams:params - completion:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsAddGroup() : ClusterCommand("add-group") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("GroupName", &mRequest.groupName); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRGroupsClusterAddGroupParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() + length:mRequest.groupName.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + addGroupWithParams:params + completion:^( + MTRGroupsClusterAddGroupResponseParams *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Groups::Commands::AddGroup::Type mRequest; + chip::app::Clusters::Groups::Commands::AddGroup::Type mRequest; }; /* @@ -794,44 +926,54 @@ class GroupsAddGroup : public ClusterCommand { */ class GroupsViewGroup : public ClusterCommand { public: - GroupsViewGroup() - : ClusterCommand("view-group") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster viewGroupWithParams:params - completion:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsViewGroup() : ClusterCommand("view-group") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRGroupsClusterViewGroupParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster viewGroupWithParams:params + completion:^(MTRGroupsClusterViewGroupResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Groups::Commands::ViewGroup::Type mRequest; + chip::app::Clusters::Groups::Commands::ViewGroup::Type mRequest; }; /* @@ -839,55 +981,69 @@ class GroupsViewGroup : public ClusterCommand { */ class GroupsGetGroupMembership : public ClusterCommand { public: - GroupsGetGroupMembership() - : ClusterCommand("get-group-membership") - , mComplex_GroupList(&mRequest.groupList) - { - AddArgument("GroupList", &mComplex_GroupList); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterGetGroupMembershipParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.groupList) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; - [array_0 addObject:newElement_0]; - } - params.groupList = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getGroupMembershipWithParams:params - completion:^(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsGetGroupMembership() + : ClusterCommand("get-group-membership"), + mComplex_GroupList(&mRequest.groupList) { + AddArgument("GroupList", &mComplex_GroupList); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupsClusterGetGroupMembershipParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.groupList) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + params.groupList = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getGroupMembershipWithParams:params + completion:^( + MTRGroupsClusterGetGroupMembershipResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Groups::Commands::GetGroupMembership::Type mRequest; - TypedComplexArgument> mComplex_GroupList; + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type mRequest; + TypedComplexArgument> + mComplex_GroupList; }; /* @@ -895,45 +1051,54 @@ class GroupsGetGroupMembership : public ClusterCommand { */ class GroupsRemoveGroup : public ClusterCommand { public: - GroupsRemoveGroup() - : ClusterCommand("remove-group") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterRemoveGroupParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - removeGroupWithParams:params - completion:^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsRemoveGroup() : ClusterCommand("remove-group") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRGroupsClusterRemoveGroupParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeGroupWithParams:params + completion:^(MTRGroupsClusterRemoveGroupResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Groups::Commands::RemoveGroup::Type mRequest; + chip::app::Clusters::Groups::Commands::RemoveGroup::Type mRequest; }; /* @@ -941,38 +1106,46 @@ class GroupsRemoveGroup : public ClusterCommand { */ class GroupsRemoveAllGroups : public ClusterCommand { public: - GroupsRemoveAllGroups() - : ClusterCommand("remove-all-groups") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterRemoveAllGroupsParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster removeAllGroupsWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsRemoveAllGroups() : ClusterCommand("remove-all-groups") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRGroupsClusterRemoveAllGroupsParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeAllGroupsWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -982,47 +1155,56 @@ class GroupsRemoveAllGroups : public ClusterCommand { */ class GroupsAddGroupIfIdentifying : public ClusterCommand { public: - GroupsAddGroupIfIdentifying() - : ClusterCommand("add-group-if-identifying") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("GroupName", &mRequest.groupName); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRGroupsClusterAddGroupIfIdentifyingParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() - length:mRequest.groupName.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster addGroupIfIdentifyingWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupsAddGroupIfIdentifying() : ClusterCommand("add-group-if-identifying") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("GroupName", &mRequest.groupName); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000004) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupsClusterAddGroupIfIdentifyingParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() + length:mRequest.groupName.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster addGroupIfIdentifyingWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Type mRequest; + chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Type mRequest; }; /* @@ -1030,65 +1212,76 @@ class GroupsAddGroupIfIdentifying : public ClusterCommand { */ class ReadGroupsNameSupport : public ReadAttribute { public: - ReadGroupsNameSupport() - : ReadAttribute("name-support") - { - } - - ~ReadGroupsNameSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNameSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.NameSupport response %@", [value description]); - if (error != nil) { - LogNSError("Groups NameSupport read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsNameSupport() : ReadAttribute("name-support") {} + + ~ReadGroupsNameSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNameSupportWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.NameSupport response %@", [value description]); + if (error != nil) { + LogNSError("Groups NameSupport read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsNameSupport : public SubscribeAttribute { public: - SubscribeAttributeGroupsNameSupport() - : SubscribeAttribute("name-support") - { - } + SubscribeAttributeGroupsNameSupport() : SubscribeAttribute("name-support") {} - ~SubscribeAttributeGroupsNameSupport() {} + ~SubscribeAttributeGroupsNameSupport() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNameSupportWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNameSupportWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.NameSupport response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.NameSupport response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -1096,65 +1289,78 @@ class SubscribeAttributeGroupsNameSupport : public SubscribeAttribute { */ class ReadGroupsGeneratedCommandList : public ReadAttribute { public: - ReadGroupsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadGroupsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Groups GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadGroupsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Groups GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsGeneratedCommandList : public SubscribeAttribute { public: - SubscribeAttributeGroupsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeGroupsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} - ~SubscribeAttributeGroupsGeneratedCommandList() {} + ~SubscribeAttributeGroupsGeneratedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -1162,65 +1368,77 @@ class SubscribeAttributeGroupsGeneratedCommandList : public SubscribeAttribute { */ class ReadGroupsAcceptedCommandList : public ReadAttribute { public: - ReadGroupsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadGroupsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Groups AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadGroupsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Groups AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeGroupsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeGroupsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeGroupsAcceptedCommandList() {} + ~SubscribeAttributeGroupsAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -1228,65 +1446,77 @@ class SubscribeAttributeGroupsAcceptedCommandList : public SubscribeAttribute { */ class ReadGroupsAttributeList : public ReadAttribute { public: - ReadGroupsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadGroupsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Groups AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadGroupsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Groups AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsAttributeList : public SubscribeAttribute { public: - SubscribeAttributeGroupsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeGroupsAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeGroupsAttributeList() {} + ~SubscribeAttributeGroupsAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -1294,65 +1524,76 @@ class SubscribeAttributeGroupsAttributeList : public SubscribeAttribute { */ class ReadGroupsFeatureMap : public ReadAttribute { public: - ReadGroupsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadGroupsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Groups FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadGroupsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Groups.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Groups FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeGroupsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeGroupsFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeGroupsFeatureMap() {} + ~SubscribeAttributeGroupsFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -1360,65 +1601,77 @@ class SubscribeAttributeGroupsFeatureMap : public SubscribeAttribute { */ class ReadGroupsClusterRevision : public ReadAttribute { public: - ReadGroupsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadGroupsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Groups ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupsClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadGroupsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Groups ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeGroupsClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeGroupsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeGroupsClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeGroupsClusterRevision() {} + ~SubscribeAttributeGroupsClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000004) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000004) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroups alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Groups.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Groups.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -1457,89 +1710,105 @@ class SubscribeAttributeGroupsClusterRevision : public SubscribeAttribute { */ class ScenesAddScene : public ClusterCommand { public: - ScenesAddScene() - : ClusterCommand("add-scene") - , mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("SceneName", &mRequest.sceneName); - AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterAddSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.sceneName = [[NSString alloc] initWithBytes:mRequest.sceneName.data() - length:mRequest.sceneName.size() - encoding:NSUTF8StringEncoding]; + ScenesAddScene() + : ClusterCommand("add-scene"), + mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("SceneName", &mRequest.sceneName); + AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterAddSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.sceneName = [[NSString alloc] initWithBytes:mRequest.sceneName.data() + length:mRequest.sceneName.size() + encoding:NSUTF8StringEncoding]; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.extensionFieldSets) { + MTRScenesClusterExtensionFieldSet *newElement_0; + newElement_0 = [MTRScenesClusterExtensionFieldSet new]; + newElement_0.clusterId = + [NSNumber numberWithUnsignedInt:entry_0.clusterId]; { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.extensionFieldSets) { - MTRScenesClusterExtensionFieldSet * newElement_0; - newElement_0 = [MTRScenesClusterExtensionFieldSet new]; - newElement_0.clusterId = [NSNumber numberWithUnsignedInt:entry_0.clusterId]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.attributeValueList) { - MTRScenesClusterAttributeValuePair * newElement_2; - newElement_2 = [MTRScenesClusterAttributeValuePair new]; - if (entry_2.attributeId.HasValue()) { - newElement_2.attributeId = [NSNumber numberWithUnsignedInt:entry_2.attributeId.Value()]; - } else { - newElement_2.attributeId = nil; - } - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - for (auto & entry_4 : entry_2.attributeValue) { - NSNumber * newElement_4; - newElement_4 = [NSNumber numberWithUnsignedChar:entry_4]; - [array_4 addObject:newElement_4]; - } - newElement_2.attributeValue = array_4; - } - [array_2 addObject:newElement_2]; - } - newElement_0.attributeValueList = array_2; - } - [array_0 addObject:newElement_0]; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.attributeValueList) { + MTRScenesClusterAttributeValuePair *newElement_2; + newElement_2 = [MTRScenesClusterAttributeValuePair new]; + if (entry_2.attributeId.HasValue()) { + newElement_2.attributeId = + [NSNumber numberWithUnsignedInt:entry_2.attributeId.Value()]; + } else { + newElement_2.attributeId = nil; } - params.extensionFieldSets = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster addSceneWithParams:params - completion:^(MTRScenesClusterAddSceneResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + { // Scope for our temporary variables + auto *array_4 = [NSMutableArray new]; + for (auto &entry_4 : entry_2.attributeValue) { + NSNumber *newElement_4; + newElement_4 = [NSNumber numberWithUnsignedChar:entry_4]; + [array_4 addObject:newElement_4]; + } + newElement_2.attributeValue = array_4; + } + [array_2 addObject:newElement_2]; + } + newElement_0.attributeValueList = array_2; + } + [array_0 addObject:newElement_0]; + } + params.extensionFieldSets = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + addSceneWithParams:params + completion:^( + MTRScenesClusterAddSceneResponseParams *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::AddScene::Type mRequest; - TypedComplexArgument> - mComplex_ExtensionFieldSets; + chip::app::Clusters::Scenes::Commands::AddScene::Type mRequest; + TypedComplexArgument> + mComplex_ExtensionFieldSets; }; /* @@ -1547,46 +1816,56 @@ class ScenesAddScene : public ClusterCommand { */ class ScenesViewScene : public ClusterCommand { public: - ScenesViewScene() - : ClusterCommand("view-scene") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterViewSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster viewSceneWithParams:params - completion:^(MTRScenesClusterViewSceneResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesViewScene() : ClusterCommand("view-scene") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterViewSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster viewSceneWithParams:params + completion:^(MTRScenesClusterViewSceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::ViewScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::ViewScene::Type mRequest; }; /* @@ -1594,47 +1873,56 @@ class ScenesViewScene : public ClusterCommand { */ class ScenesRemoveScene : public ClusterCommand { public: - ScenesRemoveScene() - : ClusterCommand("remove-scene") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterRemoveSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - removeSceneWithParams:params - completion:^(MTRScenesClusterRemoveSceneResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesRemoveScene() : ClusterCommand("remove-scene") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterRemoveSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeSceneWithParams:params + completion:^(MTRScenesClusterRemoveSceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::RemoveScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::RemoveScene::Type mRequest; }; /* @@ -1642,45 +1930,55 @@ class ScenesRemoveScene : public ClusterCommand { */ class ScenesRemoveAllScenes : public ClusterCommand { public: - ScenesRemoveAllScenes() - : ClusterCommand("remove-all-scenes") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterRemoveAllScenesParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster removeAllScenesWithParams:params - completion:^(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesRemoveAllScenes() : ClusterCommand("remove-all-scenes") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterRemoveAllScenesParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeAllScenesWithParams:params + completion:^( + MTRScenesClusterRemoveAllScenesResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::RemoveAllScenes::Type mRequest; + chip::app::Clusters::Scenes::Commands::RemoveAllScenes::Type mRequest; }; /* @@ -1688,47 +1986,56 @@ class ScenesRemoveAllScenes : public ClusterCommand { */ class ScenesStoreScene : public ClusterCommand { public: - ScenesStoreScene() - : ClusterCommand("store-scene") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterStoreSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - storeSceneWithParams:params - completion:^(MTRScenesClusterStoreSceneResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesStoreScene() : ClusterCommand("store-scene") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterStoreSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster storeSceneWithParams:params + completion:^(MTRScenesClusterStoreSceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::StoreScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::StoreScene::Type mRequest; }; /* @@ -1736,55 +2043,64 @@ class ScenesStoreScene : public ClusterCommand { */ class ScenesRecallScene : public ClusterCommand { public: - ScenesRecallScene() - : ClusterCommand("recall-scene") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterRecallSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - if (mRequest.transitionTime.HasValue()) { - if (mRequest.transitionTime.Value().IsNull()) { - params.transitionTime = nil; - } else { - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value().Value()]; - } - } else { - params.transitionTime = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster recallSceneWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + ScenesRecallScene() : ClusterCommand("recall-scene") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterRecallSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + if (mRequest.transitionTime.HasValue()) { + if (mRequest.transitionTime.Value().IsNull()) { + params.transitionTime = nil; + } else { + params.transitionTime = [NSNumber + numberWithUnsignedShort:mRequest.transitionTime.Value().Value()]; + } + } else { + params.transitionTime = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster recallSceneWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::RecallScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::RecallScene::Type mRequest; }; /* @@ -1792,45 +2108,57 @@ class ScenesRecallScene : public ClusterCommand { */ class ScenesGetSceneMembership : public ClusterCommand { public: - ScenesGetSceneMembership() - : ClusterCommand("get-scene-membership") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterGetSceneMembershipParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getSceneMembershipWithParams:params - completion:^(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesGetSceneMembership() : ClusterCommand("get-scene-membership") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRScenesClusterGetSceneMembershipParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getSceneMembershipWithParams:params + completion:^( + MTRScenesClusterGetSceneMembershipResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::GetSceneMembership::Type mRequest; + chip::app::Clusters::Scenes::Commands::GetSceneMembership::Type mRequest; }; /* @@ -1838,90 +2166,106 @@ class ScenesGetSceneMembership : public ClusterCommand { */ class ScenesEnhancedAddScene : public ClusterCommand { public: - ScenesEnhancedAddScene() - : ClusterCommand("enhanced-add-scene") - , mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("SceneName", &mRequest.sceneName); - AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000040) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterEnhancedAddSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.sceneName = [[NSString alloc] initWithBytes:mRequest.sceneName.data() - length:mRequest.sceneName.size() - encoding:NSUTF8StringEncoding]; + ScenesEnhancedAddScene() + : ClusterCommand("enhanced-add-scene"), + mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("SceneName", &mRequest.sceneName); + AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000040) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterEnhancedAddSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.sceneName = [[NSString alloc] initWithBytes:mRequest.sceneName.data() + length:mRequest.sceneName.size() + encoding:NSUTF8StringEncoding]; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.extensionFieldSets) { + MTRScenesClusterExtensionFieldSet *newElement_0; + newElement_0 = [MTRScenesClusterExtensionFieldSet new]; + newElement_0.clusterId = + [NSNumber numberWithUnsignedInt:entry_0.clusterId]; { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.extensionFieldSets) { - MTRScenesClusterExtensionFieldSet * newElement_0; - newElement_0 = [MTRScenesClusterExtensionFieldSet new]; - newElement_0.clusterId = [NSNumber numberWithUnsignedInt:entry_0.clusterId]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.attributeValueList) { - MTRScenesClusterAttributeValuePair * newElement_2; - newElement_2 = [MTRScenesClusterAttributeValuePair new]; - if (entry_2.attributeId.HasValue()) { - newElement_2.attributeId = [NSNumber numberWithUnsignedInt:entry_2.attributeId.Value()]; - } else { - newElement_2.attributeId = nil; - } - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - for (auto & entry_4 : entry_2.attributeValue) { - NSNumber * newElement_4; - newElement_4 = [NSNumber numberWithUnsignedChar:entry_4]; - [array_4 addObject:newElement_4]; - } - newElement_2.attributeValue = array_4; - } - [array_2 addObject:newElement_2]; - } - newElement_0.attributeValueList = array_2; - } - [array_0 addObject:newElement_0]; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.attributeValueList) { + MTRScenesClusterAttributeValuePair *newElement_2; + newElement_2 = [MTRScenesClusterAttributeValuePair new]; + if (entry_2.attributeId.HasValue()) { + newElement_2.attributeId = + [NSNumber numberWithUnsignedInt:entry_2.attributeId.Value()]; + } else { + newElement_2.attributeId = nil; } - params.extensionFieldSets = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedAddSceneWithParams:params - completion:^(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + { // Scope for our temporary variables + auto *array_4 = [NSMutableArray new]; + for (auto &entry_4 : entry_2.attributeValue) { + NSNumber *newElement_4; + newElement_4 = [NSNumber numberWithUnsignedChar:entry_4]; + [array_4 addObject:newElement_4]; + } + newElement_2.attributeValue = array_4; + } + [array_2 addObject:newElement_2]; + } + newElement_0.attributeValueList = array_2; + } + [array_0 addObject:newElement_0]; + } + params.extensionFieldSets = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + enhancedAddSceneWithParams:params + completion:^( + MTRScenesClusterEnhancedAddSceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::EnhancedAddScene::Type mRequest; - TypedComplexArgument> - mComplex_ExtensionFieldSets; + chip::app::Clusters::Scenes::Commands::EnhancedAddScene::Type mRequest; + TypedComplexArgument> + mComplex_ExtensionFieldSets; }; /* @@ -1929,47 +2273,59 @@ class ScenesEnhancedAddScene : public ClusterCommand { */ class ScenesEnhancedViewScene : public ClusterCommand { public: - ScenesEnhancedViewScene() - : ClusterCommand("enhanced-view-scene") - { - AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); - AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000041) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterEnhancedViewSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; - params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedViewSceneWithParams:params - completion:^(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesEnhancedViewScene() : ClusterCommand("enhanced-view-scene") { + AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); + AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000041) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRScenesClusterEnhancedViewSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupId = [NSNumber numberWithUnsignedShort:mRequest.groupId]; + params.sceneId = [NSNumber numberWithUnsignedChar:mRequest.sceneId]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + enhancedViewSceneWithParams:params + completion:^( + MTRScenesClusterEnhancedViewSceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::EnhancedViewScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::EnhancedViewScene::Type mRequest; }; /* @@ -1977,52 +2333,63 @@ class ScenesEnhancedViewScene : public ClusterCommand { */ class ScenesCopyScene : public ClusterCommand { public: - ScenesCopyScene() - : ClusterCommand("copy-scene") - { - AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); - AddArgument("GroupIdFrom", 0, UINT16_MAX, &mRequest.groupIdFrom); - AddArgument("SceneIdFrom", 0, UINT8_MAX, &mRequest.sceneIdFrom); - AddArgument("GroupIdTo", 0, UINT16_MAX, &mRequest.groupIdTo); - AddArgument("SceneIdTo", 0, UINT8_MAX, &mRequest.sceneIdTo); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) command (0x00000042) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRScenesClusterCopySceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.mode = [NSNumber numberWithUnsignedChar:mRequest.mode.Raw()]; - params.groupIdFrom = [NSNumber numberWithUnsignedShort:mRequest.groupIdFrom]; - params.sceneIdFrom = [NSNumber numberWithUnsignedChar:mRequest.sceneIdFrom]; - params.groupIdTo = [NSNumber numberWithUnsignedShort:mRequest.groupIdTo]; - params.sceneIdTo = [NSNumber numberWithUnsignedChar:mRequest.sceneIdTo]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster copySceneWithParams:params - completion:^(MTRScenesClusterCopySceneResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ScenesCopyScene() : ClusterCommand("copy-scene") { + AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); + AddArgument("GroupIdFrom", 0, UINT16_MAX, &mRequest.groupIdFrom); + AddArgument("SceneIdFrom", 0, UINT8_MAX, &mRequest.sceneIdFrom); + AddArgument("GroupIdTo", 0, UINT16_MAX, &mRequest.groupIdTo); + AddArgument("SceneIdTo", 0, UINT8_MAX, &mRequest.sceneIdTo); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000005) command (0x00000042) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRScenesClusterCopySceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.mode = [NSNumber numberWithUnsignedChar:mRequest.mode.Raw()]; + params.groupIdFrom = + [NSNumber numberWithUnsignedShort:mRequest.groupIdFrom]; + params.sceneIdFrom = [NSNumber numberWithUnsignedChar:mRequest.sceneIdFrom]; + params.groupIdTo = [NSNumber numberWithUnsignedShort:mRequest.groupIdTo]; + params.sceneIdTo = [NSNumber numberWithUnsignedChar:mRequest.sceneIdTo]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster copySceneWithParams:params + completion:^(MTRScenesClusterCopySceneResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Scenes::Commands::CopyScene::Type mRequest; + chip::app::Clusters::Scenes::Commands::CopyScene::Type mRequest; }; /* @@ -2030,65 +2397,76 @@ class ScenesCopyScene : public ClusterCommand { */ class ReadScenesSceneCount : public ReadAttribute { public: - ReadScenesSceneCount() - : ReadAttribute("scene-count") - { - } - - ~ReadScenesSceneCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSceneCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.SceneCount response %@", [value description]); - if (error != nil) { - LogNSError("Scenes SceneCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesSceneCount() : ReadAttribute("scene-count") {} + + ~ReadScenesSceneCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSceneCountWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Scenes.SceneCount response %@", [value description]); + if (error != nil) { + LogNSError("Scenes SceneCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesSceneCount : public SubscribeAttribute { public: - SubscribeAttributeScenesSceneCount() - : SubscribeAttribute("scene-count") - { - } + SubscribeAttributeScenesSceneCount() : SubscribeAttribute("scene-count") {} - ~SubscribeAttributeScenesSceneCount() {} + ~SubscribeAttributeScenesSceneCount() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSceneCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSceneCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.SceneCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.SceneCount response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2096,65 +2474,77 @@ class SubscribeAttributeScenesSceneCount : public SubscribeAttribute { */ class ReadScenesCurrentScene : public ReadAttribute { public: - ReadScenesCurrentScene() - : ReadAttribute("current-scene") - { - } - - ~ReadScenesCurrentScene() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeCurrentSceneWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.CurrentScene response %@", [value description]); - if (error != nil) { - LogNSError("Scenes CurrentScene read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesCurrentScene() : ReadAttribute("current-scene") {} + + ~ReadScenesCurrentScene() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentSceneWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.CurrentScene response %@", [value description]); + if (error != nil) { + LogNSError("Scenes CurrentScene read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesCurrentScene : public SubscribeAttribute { public: - SubscribeAttributeScenesCurrentScene() - : SubscribeAttribute("current-scene") - { - } + SubscribeAttributeScenesCurrentScene() + : SubscribeAttribute("current-scene") {} - ~SubscribeAttributeScenesCurrentScene() {} + ~SubscribeAttributeScenesCurrentScene() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentSceneWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentSceneWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.CurrentScene response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.CurrentScene response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2162,65 +2552,77 @@ class SubscribeAttributeScenesCurrentScene : public SubscribeAttribute { */ class ReadScenesCurrentGroup : public ReadAttribute { public: - ReadScenesCurrentGroup() - : ReadAttribute("current-group") - { - } - - ~ReadScenesCurrentGroup() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeCurrentGroupWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.CurrentGroup response %@", [value description]); - if (error != nil) { - LogNSError("Scenes CurrentGroup read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesCurrentGroup() : ReadAttribute("current-group") {} + + ~ReadScenesCurrentGroup() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentGroupWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.CurrentGroup response %@", [value description]); + if (error != nil) { + LogNSError("Scenes CurrentGroup read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesCurrentGroup : public SubscribeAttribute { public: - SubscribeAttributeScenesCurrentGroup() - : SubscribeAttribute("current-group") - { - } + SubscribeAttributeScenesCurrentGroup() + : SubscribeAttribute("current-group") {} - ~SubscribeAttributeScenesCurrentGroup() {} + ~SubscribeAttributeScenesCurrentGroup() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentGroupWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentGroupWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.CurrentGroup response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.CurrentGroup response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2228,65 +2630,76 @@ class SubscribeAttributeScenesCurrentGroup : public SubscribeAttribute { */ class ReadScenesSceneValid : public ReadAttribute { public: - ReadScenesSceneValid() - : ReadAttribute("scene-valid") - { - } - - ~ReadScenesSceneValid() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSceneValidWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.SceneValid response %@", [value description]); - if (error != nil) { - LogNSError("Scenes SceneValid read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesSceneValid() : ReadAttribute("scene-valid") {} + + ~ReadScenesSceneValid() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSceneValidWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Scenes.SceneValid response %@", [value description]); + if (error != nil) { + LogNSError("Scenes SceneValid read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesSceneValid : public SubscribeAttribute { public: - SubscribeAttributeScenesSceneValid() - : SubscribeAttribute("scene-valid") - { - } + SubscribeAttributeScenesSceneValid() : SubscribeAttribute("scene-valid") {} - ~SubscribeAttributeScenesSceneValid() {} + ~SubscribeAttributeScenesSceneValid() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSceneValidWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSceneValidWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.SceneValid response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.SceneValid response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2294,65 +2707,76 @@ class SubscribeAttributeScenesSceneValid : public SubscribeAttribute { */ class ReadScenesNameSupport : public ReadAttribute { public: - ReadScenesNameSupport() - : ReadAttribute("name-support") - { - } - - ~ReadScenesNameSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNameSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.NameSupport response %@", [value description]); - if (error != nil) { - LogNSError("Scenes NameSupport read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesNameSupport() : ReadAttribute("name-support") {} + + ~ReadScenesNameSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNameSupportWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.NameSupport response %@", [value description]); + if (error != nil) { + LogNSError("Scenes NameSupport read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesNameSupport : public SubscribeAttribute { public: - SubscribeAttributeScenesNameSupport() - : SubscribeAttribute("name-support") - { - } + SubscribeAttributeScenesNameSupport() : SubscribeAttribute("name-support") {} - ~SubscribeAttributeScenesNameSupport() {} + ~SubscribeAttributeScenesNameSupport() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNameSupportWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNameSupportWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.NameSupport response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.NameSupport response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2360,65 +2784,77 @@ class SubscribeAttributeScenesNameSupport : public SubscribeAttribute { */ class ReadScenesLastConfiguredBy : public ReadAttribute { public: - ReadScenesLastConfiguredBy() - : ReadAttribute("last-configured-by") - { - } - - ~ReadScenesLastConfiguredBy() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLastConfiguredByWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.LastConfiguredBy response %@", [value description]); - if (error != nil) { - LogNSError("Scenes LastConfiguredBy read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesLastConfiguredBy() : ReadAttribute("last-configured-by") {} + + ~ReadScenesLastConfiguredBy() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLastConfiguredByWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.LastConfiguredBy response %@", [value description]); + if (error != nil) { + LogNSError("Scenes LastConfiguredBy read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesLastConfiguredBy : public SubscribeAttribute { public: - SubscribeAttributeScenesLastConfiguredBy() - : SubscribeAttribute("last-configured-by") - { - } + SubscribeAttributeScenesLastConfiguredBy() + : SubscribeAttribute("last-configured-by") {} - ~SubscribeAttributeScenesLastConfiguredBy() {} + ~SubscribeAttributeScenesLastConfiguredBy() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLastConfiguredByWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLastConfiguredByWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.LastConfiguredBy response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.LastConfiguredBy response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2426,65 +2862,78 @@ class SubscribeAttributeScenesLastConfiguredBy : public SubscribeAttribute { */ class ReadScenesGeneratedCommandList : public ReadAttribute { public: - ReadScenesGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadScenesGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Scenes GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadScenesGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Scenes GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesGeneratedCommandList : public SubscribeAttribute { public: - SubscribeAttributeScenesGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeScenesGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} - ~SubscribeAttributeScenesGeneratedCommandList() {} + ~SubscribeAttributeScenesGeneratedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2492,65 +2941,77 @@ class SubscribeAttributeScenesGeneratedCommandList : public SubscribeAttribute { */ class ReadScenesAcceptedCommandList : public ReadAttribute { public: - ReadScenesAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadScenesAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Scenes AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadScenesAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Scenes AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeScenesAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeScenesAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeScenesAcceptedCommandList() {} + ~SubscribeAttributeScenesAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2558,65 +3019,77 @@ class SubscribeAttributeScenesAcceptedCommandList : public SubscribeAttribute { */ class ReadScenesAttributeList : public ReadAttribute { public: - ReadScenesAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadScenesAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Scenes AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadScenesAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Scenes AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesAttributeList : public SubscribeAttribute { public: - SubscribeAttributeScenesAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeScenesAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeScenesAttributeList() {} + ~SubscribeAttributeScenesAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2624,65 +3097,76 @@ class SubscribeAttributeScenesAttributeList : public SubscribeAttribute { */ class ReadScenesFeatureMap : public ReadAttribute { public: - ReadScenesFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadScenesFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadScenesFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Scenes.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Scenes FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadScenesFeatureMap() {} +class SubscribeAttributeScenesFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeScenesFeatureMap() : SubscribeAttribute("feature-map") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + ~SubscribeAttributeScenesFeatureMap() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Scenes FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeScenesFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeScenesFeatureMap() - : SubscribeAttribute("feature-map") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeScenesFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -2690,65 +3174,77 @@ class SubscribeAttributeScenesFeatureMap : public SubscribeAttribute { */ class ReadScenesClusterRevision : public ReadAttribute { public: - ReadScenesClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadScenesClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Scenes ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadScenesClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadScenesClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Scenes ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeScenesClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeScenesClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeScenesClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeScenesClusterRevision() {} + ~SubscribeAttributeScenesClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000005) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000005) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterScenes alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Scenes.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -2782,38 +3278,44 @@ class SubscribeAttributeScenesClusterRevision : public SubscribeAttribute { */ class OnOffOff : public ClusterCommand { public: - OnOffOff() - : ClusterCommand("off") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster offWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + OnOffOff() : ClusterCommand("off") { ClusterCommand::AddArguments(); } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTROnOffClusterOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster offWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -2823,38 +3325,44 @@ class OnOffOff : public ClusterCommand { */ class OnOffOn : public ClusterCommand { public: - OnOffOn() - : ClusterCommand("on") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterOnParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster onWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + OnOffOn() : ClusterCommand("on") { ClusterCommand::AddArguments(); } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTROnOffClusterOnParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster onWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: }; @@ -2864,38 +3372,44 @@ class OnOffOn : public ClusterCommand { */ class OnOffToggle : public ClusterCommand { public: - OnOffToggle() - : ClusterCommand("toggle") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterToggleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster toggleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + OnOffToggle() : ClusterCommand("toggle") { ClusterCommand::AddArguments(); } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTROnOffClusterToggleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster toggleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -2905,45 +3419,55 @@ class OnOffToggle : public ClusterCommand { */ class OnOffOffWithEffect : public ClusterCommand { public: - OnOffOffWithEffect() - : ClusterCommand("off-with-effect") - { - AddArgument("EffectId", 0, UINT8_MAX, &mRequest.effectId); - AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000040) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterOffWithEffectParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.effectId = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectId)]; - params.effectVariant = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster offWithEffectWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + OnOffOffWithEffect() : ClusterCommand("off-with-effect") { + AddArgument("EffectId", 0, UINT8_MAX, &mRequest.effectId); + AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000040) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTROnOffClusterOffWithEffectParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.effectId = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.effectId)]; + params.effectVariant = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster offWithEffectWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OnOff::Commands::OffWithEffect::Type mRequest; + chip::app::Clusters::OnOff::Commands::OffWithEffect::Type mRequest; }; /* @@ -2951,38 +3475,48 @@ class OnOffOffWithEffect : public ClusterCommand { */ class OnOffOnWithRecallGlobalScene : public ClusterCommand { public: - OnOffOnWithRecallGlobalScene() - : ClusterCommand("on-with-recall-global-scene") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000041) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterOnWithRecallGlobalSceneParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster onWithRecallGlobalSceneWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + OnOffOnWithRecallGlobalScene() + : ClusterCommand("on-with-recall-global-scene") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000041) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROnOffClusterOnWithRecallGlobalSceneParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster onWithRecallGlobalSceneWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -2992,47 +3526,57 @@ class OnOffOnWithRecallGlobalScene : public ClusterCommand { */ class OnOffOnWithTimedOff : public ClusterCommand { public: - OnOffOnWithTimedOff() - : ClusterCommand("on-with-timed-off") - { - AddArgument("OnOffControl", 0, UINT8_MAX, &mRequest.onOffControl); - AddArgument("OnTime", 0, UINT16_MAX, &mRequest.onTime); - AddArgument("OffWaitTime", 0, UINT16_MAX, &mRequest.offWaitTime); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) command (0x00000042) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTROnOffClusterOnWithTimedOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.onOffControl = [NSNumber numberWithUnsignedChar:mRequest.onOffControl.Raw()]; - params.onTime = [NSNumber numberWithUnsignedShort:mRequest.onTime]; - params.offWaitTime = [NSNumber numberWithUnsignedShort:mRequest.offWaitTime]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster onWithTimedOffWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + OnOffOnWithTimedOff() : ClusterCommand("on-with-timed-off") { + AddArgument("OnOffControl", 0, UINT8_MAX, &mRequest.onOffControl); + AddArgument("OnTime", 0, UINT16_MAX, &mRequest.onTime); + AddArgument("OffWaitTime", 0, UINT16_MAX, &mRequest.offWaitTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000006) command (0x00000042) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTROnOffClusterOnWithTimedOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.onOffControl = + [NSNumber numberWithUnsignedChar:mRequest.onOffControl.Raw()]; + params.onTime = [NSNumber numberWithUnsignedShort:mRequest.onTime]; + params.offWaitTime = + [NSNumber numberWithUnsignedShort:mRequest.offWaitTime]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster onWithTimedOffWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type mRequest; + chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type mRequest; }; /* @@ -3040,65 +3584,76 @@ class OnOffOnWithTimedOff : public ClusterCommand { */ class ReadOnOffOnOff : public ReadAttribute { public: - ReadOnOffOnOff() - : ReadAttribute("on-off") - { - } - - ~ReadOnOffOnOff() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OnOff response %@", [value description]); - if (error != nil) { - LogNSError("OnOff OnOff read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffOnOff() : ReadAttribute("on-off") {} + + ~ReadOnOffOnOff() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnOffWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OnOff.OnOff response %@", [value description]); + if (error != nil) { + LogNSError("OnOff OnOff read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffOnOff : public SubscribeAttribute { public: - SubscribeAttributeOnOffOnOff() - : SubscribeAttribute("on-off") - { - } + SubscribeAttributeOnOffOnOff() : SubscribeAttribute("on-off") {} - ~SubscribeAttributeOnOffOnOff() {} + ~SubscribeAttributeOnOffOnOff() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnOffWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOnOffWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OnOff response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.OnOff response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3106,65 +3661,77 @@ class SubscribeAttributeOnOffOnOff : public SubscribeAttribute { */ class ReadOnOffGlobalSceneControl : public ReadAttribute { public: - ReadOnOffGlobalSceneControl() - : ReadAttribute("global-scene-control") - { - } - - ~ReadOnOffGlobalSceneControl() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x00004000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGlobalSceneControlWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); - if (error != nil) { - LogNSError("OnOff GlobalSceneControl read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffGlobalSceneControl() : ReadAttribute("global-scene-control") {} + + ~ReadOnOffGlobalSceneControl() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x00004000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGlobalSceneControlWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); + if (error != nil) { + LogNSError("OnOff GlobalSceneControl read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffGlobalSceneControl : public SubscribeAttribute { public: - SubscribeAttributeOnOffGlobalSceneControl() - : SubscribeAttribute("global-scene-control") - { - } + SubscribeAttributeOnOffGlobalSceneControl() + : SubscribeAttribute("global-scene-control") {} - ~SubscribeAttributeOnOffGlobalSceneControl() {} + ~SubscribeAttributeOnOffGlobalSceneControl() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGlobalSceneControlWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGlobalSceneControlWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3172,103 +3739,126 @@ class SubscribeAttributeOnOffGlobalSceneControl : public SubscribeAttribute { */ class ReadOnOffOnTime : public ReadAttribute { public: - ReadOnOffOnTime() - : ReadAttribute("on-time") - { - } - - ~ReadOnOffOnTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x00004001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOnTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OnTime response %@", [value description]); - if (error != nil) { - LogNSError("OnOff OnTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffOnTime() : ReadAttribute("on-time") {} + + ~ReadOnOffOnTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x00004001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnTimeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OnOff.OnTime response %@", [value description]); + if (error != nil) { + LogNSError("OnOff OnTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteOnOffOnTime : public WriteAttribute { public: - WriteOnOffOnTime() - : WriteAttribute("on-time") - { - AddArgument("attr-name", "on-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOnOffOnTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) WriteAttribute (0x00004001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOnTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OnOff OnTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteOnOffOnTime() : WriteAttribute("on-time") { + AddArgument("attr-name", "on-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOnOffOnTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) WriteAttribute (0x00004001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOnTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("OnOff OnTime write Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeOnOffOnTime : public SubscribeAttribute { public: - SubscribeAttributeOnOffOnTime() - : SubscribeAttribute("on-time") - { - } + SubscribeAttributeOnOffOnTime() : SubscribeAttribute("on-time") {} - ~SubscribeAttributeOnOffOnTime() {} + ~SubscribeAttributeOnOffOnTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x00004001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x00004001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOnTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OnTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.OnTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3276,103 +3866,127 @@ class SubscribeAttributeOnOffOnTime : public SubscribeAttribute { */ class ReadOnOffOffWaitTime : public ReadAttribute { public: - ReadOnOffOffWaitTime() - : ReadAttribute("off-wait-time") - { - } - - ~ReadOnOffOffWaitTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x00004002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOffWaitTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OffWaitTime response %@", [value description]); - if (error != nil) { - LogNSError("OnOff OffWaitTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffOffWaitTime() : ReadAttribute("off-wait-time") {} + + ~ReadOnOffOffWaitTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x00004002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOffWaitTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.OffWaitTime response %@", [value description]); + if (error != nil) { + LogNSError("OnOff OffWaitTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteOnOffOffWaitTime : public WriteAttribute { public: - WriteOnOffOffWaitTime() - : WriteAttribute("off-wait-time") - { - AddArgument("attr-name", "off-wait-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOnOffOffWaitTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) WriteAttribute (0x00004002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOffWaitTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OnOff OffWaitTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteOnOffOffWaitTime() : WriteAttribute("off-wait-time") { + AddArgument("attr-name", "off-wait-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOnOffOffWaitTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) WriteAttribute (0x00004002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOffWaitTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("OnOff OffWaitTime write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeOnOffOffWaitTime : public SubscribeAttribute { public: - SubscribeAttributeOnOffOffWaitTime() - : SubscribeAttribute("off-wait-time") - { - } + SubscribeAttributeOnOffOffWaitTime() : SubscribeAttribute("off-wait-time") {} - ~SubscribeAttributeOnOffOffWaitTime() {} + ~SubscribeAttributeOnOffOffWaitTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x00004002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x00004002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOffWaitTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOffWaitTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.OffWaitTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.OffWaitTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3380,103 +3994,128 @@ class SubscribeAttributeOnOffOffWaitTime : public SubscribeAttribute { */ class ReadOnOffStartUpOnOff : public ReadAttribute { public: - ReadOnOffStartUpOnOff() - : ReadAttribute("start-up-on-off") - { - } - - ~ReadOnOffStartUpOnOff() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x00004003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeStartUpOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.StartUpOnOff response %@", [value description]); - if (error != nil) { - LogNSError("OnOff StartUpOnOff read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffStartUpOnOff() : ReadAttribute("start-up-on-off") {} + + ~ReadOnOffStartUpOnOff() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x00004003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartUpOnOffWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.StartUpOnOff response %@", [value description]); + if (error != nil) { + LogNSError("OnOff StartUpOnOff read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteOnOffStartUpOnOff : public WriteAttribute { public: - WriteOnOffStartUpOnOff() - : WriteAttribute("start-up-on-off") - { - AddArgument("attr-name", "start-up-on-off"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOnOffStartUpOnOff() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) WriteAttribute (0x00004003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeStartUpOnOffWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OnOff StartUpOnOff write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteOnOffStartUpOnOff() : WriteAttribute("start-up-on-off") { + AddArgument("attr-name", "start-up-on-off"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOnOffStartUpOnOff() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) WriteAttribute (0x00004003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeStartUpOnOffWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "OnOff StartUpOnOff write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeOnOffStartUpOnOff : public SubscribeAttribute { public: - SubscribeAttributeOnOffStartUpOnOff() - : SubscribeAttribute("start-up-on-off") - { - } + SubscribeAttributeOnOffStartUpOnOff() + : SubscribeAttribute("start-up-on-off") {} - ~SubscribeAttributeOnOffStartUpOnOff() {} + ~SubscribeAttributeOnOffStartUpOnOff() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x00004003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x00004003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartUpOnOffWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeStartUpOnOffWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.StartUpOnOff response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.StartUpOnOff response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3484,65 +4123,77 @@ class SubscribeAttributeOnOffStartUpOnOff : public SubscribeAttribute { */ class ReadOnOffGeneratedCommandList : public ReadAttribute { public: - ReadOnOffGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadOnOffGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OnOff GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadOnOffGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("OnOff GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffGeneratedCommandList : public SubscribeAttribute { public: - SubscribeAttributeOnOffGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeOnOffGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} - ~SubscribeAttributeOnOffGeneratedCommandList() {} + ~SubscribeAttributeOnOffGeneratedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3550,65 +4201,77 @@ class SubscribeAttributeOnOffGeneratedCommandList : public SubscribeAttribute { */ class ReadOnOffAcceptedCommandList : public ReadAttribute { public: - ReadOnOffAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadOnOffAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OnOff AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadOnOffAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("OnOff AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeOnOffAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeOnOffAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeOnOffAcceptedCommandList() {} + ~SubscribeAttributeOnOffAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3616,65 +4279,77 @@ class SubscribeAttributeOnOffAcceptedCommandList : public SubscribeAttribute { */ class ReadOnOffAttributeList : public ReadAttribute { public: - ReadOnOffAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadOnOffAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OnOff AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadOnOffAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("OnOff AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffAttributeList : public SubscribeAttribute { public: - SubscribeAttributeOnOffAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeOnOffAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeOnOffAttributeList() {} + ~SubscribeAttributeOnOffAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3682,65 +4357,76 @@ class SubscribeAttributeOnOffAttributeList : public SubscribeAttribute { */ class ReadOnOffFeatureMap : public ReadAttribute { public: - ReadOnOffFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadOnOffFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OnOff FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOnOffFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OnOff.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("OnOff FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeOnOffFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeOnOffFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeOnOffFeatureMap() {} + ~SubscribeAttributeOnOffFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -3748,65 +4434,77 @@ class SubscribeAttributeOnOffFeatureMap : public SubscribeAttribute { */ class ReadOnOffClusterRevision : public ReadAttribute { public: - ReadOnOffClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadOnOffClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OnOff ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadOnOffClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("OnOff ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeOnOffClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeOnOffClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeOnOffClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeOnOffClusterRevision() {} + ~SubscribeAttributeOnOffClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000006) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000006) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOnOff alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOff.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOff.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -3831,69 +4529,80 @@ class SubscribeAttributeOnOffClusterRevision : public SubscribeAttribute { */ class ReadOnOffSwitchConfigurationSwitchType : public ReadAttribute { public: - ReadOnOffSwitchConfigurationSwitchType() - : ReadAttribute("switch-type") - { - } - - ~ReadOnOffSwitchConfigurationSwitchType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSwitchTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.SwitchType response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration SwitchType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationSwitchType : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationSwitchType() - : SubscribeAttribute("switch-type") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationSwitchType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSwitchTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.SwitchType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationSwitchType() : ReadAttribute("switch-type") {} + + ~ReadOnOffSwitchConfigurationSwitchType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSwitchTypeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.SwitchType response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration SwitchType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationSwitchType + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationSwitchType() + : SubscribeAttribute("switch-type") {} + + ~SubscribeAttributeOnOffSwitchConfigurationSwitchType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSwitchTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.SwitchType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -3901,109 +4610,134 @@ class SubscribeAttributeOnOffSwitchConfigurationSwitchType : public SubscribeAtt */ class ReadOnOffSwitchConfigurationSwitchActions : public ReadAttribute { public: - ReadOnOffSwitchConfigurationSwitchActions() - : ReadAttribute("switch-actions") - { - } - - ~ReadOnOffSwitchConfigurationSwitchActions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSwitchActionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.SwitchActions response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration SwitchActions read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationSwitchActions() + : ReadAttribute("switch-actions") {} + + ~ReadOnOffSwitchConfigurationSwitchActions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSwitchActionsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.SwitchActions response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration SwitchActions read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteOnOffSwitchConfigurationSwitchActions : public WriteAttribute { public: - WriteOnOffSwitchConfigurationSwitchActions() - : WriteAttribute("switch-actions") - { - AddArgument("attr-name", "switch-actions"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOnOffSwitchConfigurationSwitchActions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSwitchActionsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OnOffSwitchConfiguration SwitchActions write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteOnOffSwitchConfigurationSwitchActions() + : WriteAttribute("switch-actions") { + AddArgument("attr-name", "switch-actions"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOnOffSwitchConfigurationSwitchActions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeSwitchActionsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("OnOffSwitchConfiguration " + "SwitchActions write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeOnOffSwitchConfigurationSwitchActions : public SubscribeAttribute { +class SubscribeAttributeOnOffSwitchConfigurationSwitchActions + : public SubscribeAttribute { public: - SubscribeAttributeOnOffSwitchConfigurationSwitchActions() - : SubscribeAttribute("switch-actions") - { - } + SubscribeAttributeOnOffSwitchConfigurationSwitchActions() + : SubscribeAttribute("switch-actions") {} - ~SubscribeAttributeOnOffSwitchConfigurationSwitchActions() {} + ~SubscribeAttributeOnOffSwitchConfigurationSwitchActions() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSwitchActionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSwitchActionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.SwitchActions response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.SwitchActions response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -4011,69 +4745,82 @@ class SubscribeAttributeOnOffSwitchConfigurationSwitchActions : public Subscribe */ class ReadOnOffSwitchConfigurationGeneratedCommandList : public ReadAttribute { public: - ReadOnOffSwitchConfigurationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadOnOffSwitchConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadOnOffSwitchConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -4081,69 +4828,82 @@ class SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList : public Su */ class ReadOnOffSwitchConfigurationAcceptedCommandList : public ReadAttribute { public: - ReadOnOffSwitchConfigurationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadOnOffSwitchConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadOnOffSwitchConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -4151,69 +4911,81 @@ class SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList : public Sub */ class ReadOnOffSwitchConfigurationAttributeList : public ReadAttribute { public: - ReadOnOffSwitchConfigurationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadOnOffSwitchConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadOnOffSwitchConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeOnOffSwitchConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -4221,69 +4993,80 @@ class SubscribeAttributeOnOffSwitchConfigurationAttributeList : public Subscribe */ class ReadOnOffSwitchConfigurationFeatureMap : public ReadAttribute { public: - ReadOnOffSwitchConfigurationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadOnOffSwitchConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOnOffSwitchConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeOnOffSwitchConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -4291,69 +5074,82 @@ class SubscribeAttributeOnOffSwitchConfigurationFeatureMap : public SubscribeAtt */ class ReadOnOffSwitchConfigurationClusterRevision : public ReadAttribute { public: - ReadOnOffSwitchConfigurationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadOnOffSwitchConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OnOffSwitchConfiguration ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOnOffSwitchConfigurationClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeOnOffSwitchConfigurationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeOnOffSwitchConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000007) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OnOffSwitchConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOnOffSwitchConfigurationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadOnOffSwitchConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("OnOffSwitchConfiguration ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOnOffSwitchConfigurationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeOnOffSwitchConfigurationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeOnOffSwitchConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000007) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOnOffSwitchConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OnOffSwitchConfiguration.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -4399,55 +5195,65 @@ class SubscribeAttributeOnOffSwitchConfigurationClusterRevision : public Subscri */ class LevelControlMoveToLevel : public ClusterCommand { public: - LevelControlMoveToLevel() - : ClusterCommand("move-to-level") - { - AddArgument("Level", 0, UINT8_MAX, &mRequest.level); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; - if (mRequest.transitionTime.IsNull()) { - params.transitionTime = nil; - } else { - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToLevelWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlMoveToLevel() : ClusterCommand("move-to-level") { + AddArgument("Level", 0, UINT8_MAX, &mRequest.level); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterMoveToLevelParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; + if (mRequest.transitionTime.IsNull()) { + params.transitionTime = nil; + } else { + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToLevelWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type mRequest; + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type mRequest; }; /* @@ -4455,55 +5261,64 @@ class LevelControlMoveToLevel : public ClusterCommand { */ class LevelControlMove : public ClusterCommand { public: - LevelControlMove() - : ClusterCommand("move") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - if (mRequest.rate.IsNull()) { - params.rate = nil; - } else { - params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + LevelControlMove() : ClusterCommand("move") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRLevelControlClusterMoveParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + if (mRequest.rate.IsNull()) { + params.rate = nil; + } else { + params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::Move::Type mRequest; + chip::app::Clusters::LevelControl::Commands::Move::Type mRequest; }; /* @@ -4511,57 +5326,67 @@ class LevelControlMove : public ClusterCommand { */ class LevelControlStep : public ClusterCommand { public: - LevelControlStep() - : ClusterCommand("step") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterStepParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; - if (mRequest.transitionTime.IsNull()) { - params.transitionTime = nil; - } else { - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + LevelControlStep() : ClusterCommand("step") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRLevelControlClusterStepParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; + if (mRequest.transitionTime.IsNull()) { + params.transitionTime = nil; + } else { + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::Step::Type mRequest; + chip::app::Clusters::LevelControl::Commands::Step::Type mRequest; }; /* @@ -4569,47 +5394,55 @@ class LevelControlStep : public ClusterCommand { */ class LevelControlStop : public ClusterCommand { public: - LevelControlStop() - : ClusterCommand("stop") - { - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + LevelControlStop() : ClusterCommand("stop") { + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRLevelControlClusterStopParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::Stop::Type mRequest; + chip::app::Clusters::LevelControl::Commands::Stop::Type mRequest; }; /* @@ -4617,55 +5450,67 @@ class LevelControlStop : public ClusterCommand { */ class LevelControlMoveToLevelWithOnOff : public ClusterCommand { public: - LevelControlMoveToLevelWithOnOff() - : ClusterCommand("move-to-level-with-on-off") - { - AddArgument("Level", 0, UINT8_MAX, &mRequest.level); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterMoveToLevelWithOnOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; - if (mRequest.transitionTime.IsNull()) { - params.transitionTime = nil; - } else { - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToLevelWithOnOffWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlMoveToLevelWithOnOff() + : ClusterCommand("move-to-level-with-on-off") { + AddArgument("Level", 0, UINT8_MAX, &mRequest.level); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterMoveToLevelWithOnOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; + if (mRequest.transitionTime.IsNull()) { + params.transitionTime = nil; + } else { + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToLevelWithOnOffWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type mRequest; + chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type + mRequest; }; /* @@ -4673,55 +5518,65 @@ class LevelControlMoveToLevelWithOnOff : public ClusterCommand { */ class LevelControlMoveWithOnOff : public ClusterCommand { public: - LevelControlMoveWithOnOff() - : ClusterCommand("move-with-on-off") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterMoveWithOnOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - if (mRequest.rate.IsNull()) { - params.rate = nil; - } else { - params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveWithOnOffWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlMoveWithOnOff() : ClusterCommand("move-with-on-off") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterMoveWithOnOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + if (mRequest.rate.IsNull()) { + params.rate = nil; + } else { + params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveWithOnOffWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type mRequest; + chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type mRequest; }; /* @@ -4729,57 +5584,68 @@ class LevelControlMoveWithOnOff : public ClusterCommand { */ class LevelControlStepWithOnOff : public ClusterCommand { public: - LevelControlStepWithOnOff() - : ClusterCommand("step-with-on-off") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterStepWithOnOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; - if (mRequest.transitionTime.IsNull()) { - params.transitionTime = nil; - } else { - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; - } - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepWithOnOffWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlStepWithOnOff() : ClusterCommand("step-with-on-off") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterStepWithOnOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; + if (mRequest.transitionTime.IsNull()) { + params.transitionTime = nil; + } else { + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; + } + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepWithOnOffWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type mRequest; + chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type mRequest; }; /* @@ -4787,47 +5653,56 @@ class LevelControlStepWithOnOff : public ClusterCommand { */ class LevelControlStopWithOnOff : public ClusterCommand { public: - LevelControlStopWithOnOff() - : ClusterCommand("stop-with-on-off") - { - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopWithOnOffWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlStopWithOnOff() : ClusterCommand("stop-with-on-off") { + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.optionsMask = + [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopWithOnOffWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type mRequest; + chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type mRequest; }; /* @@ -4835,45 +5710,54 @@ class LevelControlStopWithOnOff : public ClusterCommand { */ class LevelControlMoveToClosestFrequency : public ClusterCommand { public: - LevelControlMoveToClosestFrequency() - : ClusterCommand("move-to-closest-frequency") - { - AddArgument("Frequency", 0, UINT16_MAX, &mRequest.frequency); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRLevelControlClusterMoveToClosestFrequencyParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.frequency = [NSNumber numberWithUnsignedShort:mRequest.frequency]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToClosestFrequencyWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + LevelControlMoveToClosestFrequency() + : ClusterCommand("move-to-closest-frequency") { + AddArgument("Frequency", 0, UINT16_MAX, &mRequest.frequency); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000008) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRLevelControlClusterMoveToClosestFrequencyParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.frequency = [NSNumber numberWithUnsignedShort:mRequest.frequency]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToClosestFrequencyWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type mRequest; + chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type + mRequest; }; /* @@ -4881,69 +5765,77 @@ class LevelControlMoveToClosestFrequency : public ClusterCommand { */ class ReadLevelControlCurrentLevel : public ReadAttribute { public: - ReadLevelControlCurrentLevel() - : ReadAttribute("current-level") - { - } - - ~ReadLevelControlCurrentLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.CurrentLevel response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl CurrentLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlCurrentLevel() : ReadAttribute("current-level") {} + + ~ReadLevelControlCurrentLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentLevelWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.CurrentLevel response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl CurrentLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlCurrentLevel : public SubscribeAttribute { public: - SubscribeAttributeLevelControlCurrentLevel() - : SubscribeAttribute("current-level") - { - } + SubscribeAttributeLevelControlCurrentLevel() + : SubscribeAttribute("current-level") {} - ~SubscribeAttributeLevelControlCurrentLevel() {} + ~SubscribeAttributeLevelControlCurrentLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.CurrentLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.CurrentLevel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -4951,69 +5843,77 @@ class SubscribeAttributeLevelControlCurrentLevel : public SubscribeAttribute { */ class ReadLevelControlRemainingTime : public ReadAttribute { public: - ReadLevelControlRemainingTime() - : ReadAttribute("remaining-time") - { - } - - ~ReadLevelControlRemainingTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRemainingTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.RemainingTime response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl RemainingTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlRemainingTime() : ReadAttribute("remaining-time") {} + + ~ReadLevelControlRemainingTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRemainingTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.RemainingTime response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl RemainingTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlRemainingTime : public SubscribeAttribute { public: - SubscribeAttributeLevelControlRemainingTime() - : SubscribeAttribute("remaining-time") - { - } + SubscribeAttributeLevelControlRemainingTime() + : SubscribeAttribute("remaining-time") {} - ~SubscribeAttributeLevelControlRemainingTime() {} + ~SubscribeAttributeLevelControlRemainingTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRemainingTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRemainingTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.RemainingTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.RemainingTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5021,69 +5921,76 @@ class SubscribeAttributeLevelControlRemainingTime : public SubscribeAttribute { */ class ReadLevelControlMinLevel : public ReadAttribute { public: - ReadLevelControlMinLevel() - : ReadAttribute("min-level") - { - } - - ~ReadLevelControlMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MinLevel response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl MinLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlMinLevel() : ReadAttribute("min-level") {} + + ~ReadLevelControlMinLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinLevelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LevelControl.MinLevel response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl MinLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlMinLevel : public SubscribeAttribute { public: - SubscribeAttributeLevelControlMinLevel() - : SubscribeAttribute("min-level") - { - } + SubscribeAttributeLevelControlMinLevel() : SubscribeAttribute("min-level") {} - ~SubscribeAttributeLevelControlMinLevel() {} + ~SubscribeAttributeLevelControlMinLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMinLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MinLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MinLevel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5091,69 +5998,76 @@ class SubscribeAttributeLevelControlMinLevel : public SubscribeAttribute { */ class ReadLevelControlMaxLevel : public ReadAttribute { public: - ReadLevelControlMaxLevel() - : ReadAttribute("max-level") - { - } - - ~ReadLevelControlMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MaxLevel response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl MaxLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlMaxLevel() : ReadAttribute("max-level") {} + + ~ReadLevelControlMaxLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxLevelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LevelControl.MaxLevel response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl MaxLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlMaxLevel : public SubscribeAttribute { public: - SubscribeAttributeLevelControlMaxLevel() - : SubscribeAttribute("max-level") - { - } + SubscribeAttributeLevelControlMaxLevel() : SubscribeAttribute("max-level") {} - ~SubscribeAttributeLevelControlMaxLevel() {} + ~SubscribeAttributeLevelControlMaxLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMaxLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MaxLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MaxLevel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5161,69 +6075,79 @@ class SubscribeAttributeLevelControlMaxLevel : public SubscribeAttribute { */ class ReadLevelControlCurrentFrequency : public ReadAttribute { public: - ReadLevelControlCurrentFrequency() - : ReadAttribute("current-frequency") - { - } - - ~ReadLevelControlCurrentFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl CurrentFrequency read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLevelControlCurrentFrequency : public SubscribeAttribute { -public: - SubscribeAttributeLevelControlCurrentFrequency() - : SubscribeAttribute("current-frequency") - { - } - - ~SubscribeAttributeLevelControlCurrentFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentFrequencyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLevelControlCurrentFrequency() : ReadAttribute("current-frequency") {} + + ~ReadLevelControlCurrentFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentFrequencyWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl CurrentFrequency read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLevelControlCurrentFrequency + : public SubscribeAttribute { +public: + SubscribeAttributeLevelControlCurrentFrequency() + : SubscribeAttribute("current-frequency") {} + + ~SubscribeAttributeLevelControlCurrentFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentFrequencyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.CurrentFrequency response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -5231,69 +6155,77 @@ class SubscribeAttributeLevelControlCurrentFrequency : public SubscribeAttribute */ class ReadLevelControlMinFrequency : public ReadAttribute { public: - ReadLevelControlMinFrequency() - : ReadAttribute("min-frequency") - { - } - - ~ReadLevelControlMinFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MinFrequency response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl MinFrequency read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlMinFrequency() : ReadAttribute("min-frequency") {} + + ~ReadLevelControlMinFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinFrequencyWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MinFrequency response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl MinFrequency read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlMinFrequency : public SubscribeAttribute { public: - SubscribeAttributeLevelControlMinFrequency() - : SubscribeAttribute("min-frequency") - { - } + SubscribeAttributeLevelControlMinFrequency() + : SubscribeAttribute("min-frequency") {} - ~SubscribeAttributeLevelControlMinFrequency() {} + ~SubscribeAttributeLevelControlMinFrequency() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinFrequencyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMinFrequencyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MinFrequency response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MinFrequency response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5301,69 +6233,77 @@ class SubscribeAttributeLevelControlMinFrequency : public SubscribeAttribute { */ class ReadLevelControlMaxFrequency : public ReadAttribute { public: - ReadLevelControlMaxFrequency() - : ReadAttribute("max-frequency") - { - } - - ~ReadLevelControlMaxFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MaxFrequency response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl MaxFrequency read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlMaxFrequency() : ReadAttribute("max-frequency") {} + + ~ReadLevelControlMaxFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxFrequencyWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MaxFrequency response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl MaxFrequency read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlMaxFrequency : public SubscribeAttribute { public: - SubscribeAttributeLevelControlMaxFrequency() - : SubscribeAttribute("max-frequency") - { - } + SubscribeAttributeLevelControlMaxFrequency() + : SubscribeAttribute("max-frequency") {} - ~SubscribeAttributeLevelControlMaxFrequency() {} + ~SubscribeAttributeLevelControlMaxFrequency() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxFrequencyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMaxFrequencyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.MaxFrequency response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.MaxFrequency response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5371,109 +6311,127 @@ class SubscribeAttributeLevelControlMaxFrequency : public SubscribeAttribute { */ class ReadLevelControlOptions : public ReadAttribute { public: - ReadLevelControlOptions() - : ReadAttribute("options") - { - } - - ~ReadLevelControlOptions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOptionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.Options response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl Options read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlOptions() : ReadAttribute("options") {} + + ~ReadLevelControlOptions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOptionsWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LevelControl.Options response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl Options read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlOptions : public WriteAttribute { public: - WriteLevelControlOptions() - : WriteAttribute("options") - { - AddArgument("attr-name", "options"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlOptions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOptionsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl Options write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlOptions() : WriteAttribute("options") { + AddArgument("attr-name", "options"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlOptions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOptionsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("LevelControl Options write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeLevelControlOptions : public SubscribeAttribute { public: - SubscribeAttributeLevelControlOptions() - : SubscribeAttribute("options") - { - } + SubscribeAttributeLevelControlOptions() : SubscribeAttribute("options") {} - ~SubscribeAttributeLevelControlOptions() {} + ~SubscribeAttributeLevelControlOptions() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOptionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOptionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.Options response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.Options response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5481,109 +6439,135 @@ class SubscribeAttributeLevelControlOptions : public SubscribeAttribute { */ class ReadLevelControlOnOffTransitionTime : public ReadAttribute { public: - ReadLevelControlOnOffTransitionTime() - : ReadAttribute("on-off-transition-time") - { - } - - ~ReadLevelControlOnOffTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOnOffTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnOffTransitionTime response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl OnOffTransitionTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlOnOffTransitionTime() + : ReadAttribute("on-off-transition-time") {} + + ~ReadLevelControlOnOffTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnOffTransitionTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OnOffTransitionTime response %@", + [value description]); + if (error != nil) { + LogNSError("LevelControl OnOffTransitionTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlOnOffTransitionTime : public WriteAttribute { public: - WriteLevelControlOnOffTransitionTime() - : WriteAttribute("on-off-transition-time") - { - AddArgument("attr-name", "on-off-transition-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlOnOffTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOnOffTransitionTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl OnOffTransitionTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlOnOffTransitionTime() + : WriteAttribute("on-off-transition-time") { + AddArgument("attr-name", "on-off-transition-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlOnOffTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOnOffTransitionTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("LevelControl " + "OnOffTransitionTime " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeLevelControlOnOffTransitionTime : public SubscribeAttribute { +class SubscribeAttributeLevelControlOnOffTransitionTime + : public SubscribeAttribute { public: - SubscribeAttributeLevelControlOnOffTransitionTime() - : SubscribeAttribute("on-off-transition-time") - { - } + SubscribeAttributeLevelControlOnOffTransitionTime() + : SubscribeAttribute("on-off-transition-time") {} - ~SubscribeAttributeLevelControlOnOffTransitionTime() {} + ~SubscribeAttributeLevelControlOnOffTransitionTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnOffTransitionTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOnOffTransitionTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnOffTransitionTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OnOffTransitionTime response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5591,109 +6575,127 @@ class SubscribeAttributeLevelControlOnOffTransitionTime : public SubscribeAttrib */ class ReadLevelControlOnLevel : public ReadAttribute { public: - ReadLevelControlOnLevel() - : ReadAttribute("on-level") - { - } - - ~ReadLevelControlOnLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOnLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnLevel response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl OnLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlOnLevel() : ReadAttribute("on-level") {} + + ~ReadLevelControlOnLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnLevelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LevelControl.OnLevel response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl OnLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlOnLevel : public WriteAttribute { public: - WriteLevelControlOnLevel() - : WriteAttribute("on-level") - { - AddArgument("attr-name", "on-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlOnLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOnLevelWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl OnLevel write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlOnLevel() : WriteAttribute("on-level") { + AddArgument("attr-name", "on-level"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlOnLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOnLevelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("LevelControl OnLevel write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeLevelControlOnLevel : public SubscribeAttribute { public: - SubscribeAttributeLevelControlOnLevel() - : SubscribeAttribute("on-level") - { - } + SubscribeAttributeLevelControlOnLevel() : SubscribeAttribute("on-level") {} - ~SubscribeAttributeLevelControlOnLevel() {} + ~SubscribeAttributeLevelControlOnLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOnLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OnLevel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5701,109 +6703,132 @@ class SubscribeAttributeLevelControlOnLevel : public SubscribeAttribute { */ class ReadLevelControlOnTransitionTime : public ReadAttribute { public: - ReadLevelControlOnTransitionTime() - : ReadAttribute("on-transition-time") - { - } - - ~ReadLevelControlOnTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOnTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl OnTransitionTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlOnTransitionTime() : ReadAttribute("on-transition-time") {} + + ~ReadLevelControlOnTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnTransitionTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl OnTransitionTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlOnTransitionTime : public WriteAttribute { public: - WriteLevelControlOnTransitionTime() - : WriteAttribute("on-transition-time") - { - AddArgument("attr-name", "on-transition-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlOnTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOnTransitionTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl OnTransitionTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlOnTransitionTime() : WriteAttribute("on-transition-time") { + AddArgument("attr-name", "on-transition-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlOnTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOnTransitionTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "LevelControl OnTransitionTime " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeLevelControlOnTransitionTime : public SubscribeAttribute { +class SubscribeAttributeLevelControlOnTransitionTime + : public SubscribeAttribute { public: - SubscribeAttributeLevelControlOnTransitionTime() - : SubscribeAttribute("on-transition-time") - { - } + SubscribeAttributeLevelControlOnTransitionTime() + : SubscribeAttribute("on-transition-time") {} - ~SubscribeAttributeLevelControlOnTransitionTime() {} + ~SubscribeAttributeLevelControlOnTransitionTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnTransitionTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOnTransitionTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OnTransitionTime response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5811,109 +6836,132 @@ class SubscribeAttributeLevelControlOnTransitionTime : public SubscribeAttribute */ class ReadLevelControlOffTransitionTime : public ReadAttribute { public: - ReadLevelControlOffTransitionTime() - : ReadAttribute("off-transition-time") - { - } - - ~ReadLevelControlOffTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOffTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl OffTransitionTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlOffTransitionTime() : ReadAttribute("off-transition-time") {} + + ~ReadLevelControlOffTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOffTransitionTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl OffTransitionTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlOffTransitionTime : public WriteAttribute { public: - WriteLevelControlOffTransitionTime() - : WriteAttribute("off-transition-time") - { - AddArgument("attr-name", "off-transition-time"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlOffTransitionTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOffTransitionTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl OffTransitionTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlOffTransitionTime() : WriteAttribute("off-transition-time") { + AddArgument("attr-name", "off-transition-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlOffTransitionTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOffTransitionTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "LevelControl OffTransitionTime " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeLevelControlOffTransitionTime : public SubscribeAttribute { +class SubscribeAttributeLevelControlOffTransitionTime + : public SubscribeAttribute { public: - SubscribeAttributeLevelControlOffTransitionTime() - : SubscribeAttribute("off-transition-time") - { - } + SubscribeAttributeLevelControlOffTransitionTime() + : SubscribeAttribute("off-transition-time") {} - ~SubscribeAttributeLevelControlOffTransitionTime() {} + ~SubscribeAttributeLevelControlOffTransitionTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOffTransitionTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOffTransitionTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.OffTransitionTime response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -5921,109 +6969,132 @@ class SubscribeAttributeLevelControlOffTransitionTime : public SubscribeAttribut */ class ReadLevelControlDefaultMoveRate : public ReadAttribute { public: - ReadLevelControlDefaultMoveRate() - : ReadAttribute("default-move-rate") - { - } - - ~ReadLevelControlDefaultMoveRate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDefaultMoveRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl DefaultMoveRate read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlDefaultMoveRate() : ReadAttribute("default-move-rate") {} + + ~ReadLevelControlDefaultMoveRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDefaultMoveRateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl DefaultMoveRate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlDefaultMoveRate : public WriteAttribute { public: - WriteLevelControlDefaultMoveRate() - : WriteAttribute("default-move-rate") - { - AddArgument("attr-name", "default-move-rate"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlDefaultMoveRate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeDefaultMoveRateWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl DefaultMoveRate write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlDefaultMoveRate() : WriteAttribute("default-move-rate") { + AddArgument("attr-name", "default-move-rate"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlDefaultMoveRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeDefaultMoveRateWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "LevelControl DefaultMoveRate " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeLevelControlDefaultMoveRate : public SubscribeAttribute { +class SubscribeAttributeLevelControlDefaultMoveRate + : public SubscribeAttribute { public: - SubscribeAttributeLevelControlDefaultMoveRate() - : SubscribeAttribute("default-move-rate") - { - } + SubscribeAttributeLevelControlDefaultMoveRate() + : SubscribeAttribute("default-move-rate") {} - ~SubscribeAttributeLevelControlDefaultMoveRate() {} + ~SubscribeAttributeLevelControlDefaultMoveRate() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDefaultMoveRateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDefaultMoveRateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.DefaultMoveRate response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6031,109 +7102,135 @@ class SubscribeAttributeLevelControlDefaultMoveRate : public SubscribeAttribute */ class ReadLevelControlStartUpCurrentLevel : public ReadAttribute { public: - ReadLevelControlStartUpCurrentLevel() - : ReadAttribute("start-up-current-level") - { - } - - ~ReadLevelControlStartUpCurrentLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x00004000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStartUpCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.StartUpCurrentLevel response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl StartUpCurrentLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlStartUpCurrentLevel() + : ReadAttribute("start-up-current-level") {} + + ~ReadLevelControlStartUpCurrentLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x00004000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartUpCurrentLevelWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.StartUpCurrentLevel response %@", + [value description]); + if (error != nil) { + LogNSError("LevelControl StartUpCurrentLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteLevelControlStartUpCurrentLevel : public WriteAttribute { public: - WriteLevelControlStartUpCurrentLevel() - : WriteAttribute("start-up-current-level") - { - AddArgument("attr-name", "start-up-current-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLevelControlStartUpCurrentLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) WriteAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeStartUpCurrentLevelWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LevelControl StartUpCurrentLevel write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteLevelControlStartUpCurrentLevel() + : WriteAttribute("start-up-current-level") { + AddArgument("attr-name", "start-up-current-level"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLevelControlStartUpCurrentLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) WriteAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeStartUpCurrentLevelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("LevelControl " + "StartUpCurrentLevel " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeLevelControlStartUpCurrentLevel : public SubscribeAttribute { +class SubscribeAttributeLevelControlStartUpCurrentLevel + : public SubscribeAttribute { public: - SubscribeAttributeLevelControlStartUpCurrentLevel() - : SubscribeAttribute("start-up-current-level") - { - } + SubscribeAttributeLevelControlStartUpCurrentLevel() + : SubscribeAttribute("start-up-current-level") {} - ~SubscribeAttributeLevelControlStartUpCurrentLevel() {} + ~SubscribeAttributeLevelControlStartUpCurrentLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartUpCurrentLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeStartUpCurrentLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.StartUpCurrentLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.StartUpCurrentLevel response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6141,69 +7238,81 @@ class SubscribeAttributeLevelControlStartUpCurrentLevel : public SubscribeAttrib */ class ReadLevelControlGeneratedCommandList : public ReadAttribute { public: - ReadLevelControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadLevelControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLevelControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeLevelControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeLevelControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLevelControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadLevelControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("LevelControl GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLevelControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLevelControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeLevelControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -6211,69 +7320,81 @@ class SubscribeAttributeLevelControlGeneratedCommandList : public SubscribeAttri */ class ReadLevelControlAcceptedCommandList : public ReadAttribute { public: - ReadLevelControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadLevelControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLevelControlAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeLevelControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeLevelControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLevelControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadLevelControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("LevelControl AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLevelControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLevelControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeLevelControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -6281,69 +7402,77 @@ class SubscribeAttributeLevelControlAcceptedCommandList : public SubscribeAttrib */ class ReadLevelControlAttributeList : public ReadAttribute { public: - ReadLevelControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadLevelControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadLevelControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlAttributeList : public SubscribeAttribute { public: - SubscribeAttributeLevelControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeLevelControlAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeLevelControlAttributeList() {} + ~SubscribeAttributeLevelControlAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6351,69 +7480,77 @@ class SubscribeAttributeLevelControlAttributeList : public SubscribeAttribute { */ class ReadLevelControlFeatureMap : public ReadAttribute { public: - ReadLevelControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadLevelControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLevelControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadLevelControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LevelControl.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeLevelControlFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeLevelControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeLevelControlFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeLevelControlFeatureMap() {} + ~SubscribeAttributeLevelControlFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6421,69 +7558,79 @@ class SubscribeAttributeLevelControlFeatureMap : public SubscribeAttribute { */ class ReadLevelControlClusterRevision : public ReadAttribute { public: - ReadLevelControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadLevelControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("LevelControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLevelControlClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeLevelControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeLevelControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000008) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LevelControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLevelControlClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadLevelControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("LevelControl ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLevelControlClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeLevelControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeLevelControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000008) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLevelControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LevelControl.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ @@ -6515,111 +7662,132 @@ class SubscribeAttributeLevelControlClusterRevision : public SubscribeAttribute */ class ReadBinaryInputBasicActiveText : public ReadAttribute { public: - ReadBinaryInputBasicActiveText() - : ReadAttribute("active-text") - { - } - - ~ReadBinaryInputBasicActiveText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveTextWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ActiveText response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic ActiveText read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicActiveText() : ReadAttribute("active-text") {} + + ~ReadBinaryInputBasicActiveText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveTextWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ActiveText response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic ActiveText read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicActiveText : public WriteAttribute { public: - WriteBinaryInputBasicActiveText() - : WriteAttribute("active-text") - { - AddArgument("attr-name", "active-text"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicActiveText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeActiveTextWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic ActiveText write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicActiveText() : WriteAttribute("active-text") { + AddArgument("attr-name", "active-text"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicActiveText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster writeAttributeActiveTextWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "ActiveText write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; class SubscribeAttributeBinaryInputBasicActiveText : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicActiveText() - : SubscribeAttribute("active-text") - { - } + SubscribeAttributeBinaryInputBasicActiveText() + : SubscribeAttribute("active-text") {} - ~SubscribeAttributeBinaryInputBasicActiveText() {} + ~SubscribeAttributeBinaryInputBasicActiveText() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveTextWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveTextWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ActiveText response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ActiveText response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6627,111 +7795,133 @@ class SubscribeAttributeBinaryInputBasicActiveText : public SubscribeAttribute { */ class ReadBinaryInputBasicDescription : public ReadAttribute { public: - ReadBinaryInputBasicDescription() - : ReadAttribute("description") - { - } - - ~ReadBinaryInputBasicDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000001C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Description response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic Description read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicDescription() : ReadAttribute("description") {} + + ~ReadBinaryInputBasicDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDescriptionWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Description response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic Description read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicDescription : public WriteAttribute { public: - WriteBinaryInputBasicDescription() - : WriteAttribute("description") - { - AddArgument("attr-name", "description"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeDescriptionWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic Description write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicDescription() : WriteAttribute("description") { + AddArgument("attr-name", "description"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster writeAttributeDescriptionWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "Description write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; -class SubscribeAttributeBinaryInputBasicDescription : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicDescription + : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicDescription() - : SubscribeAttribute("description") - { - } + SubscribeAttributeBinaryInputBasicDescription() + : SubscribeAttribute("description") {} - ~SubscribeAttributeBinaryInputBasicDescription() {} + ~SubscribeAttributeBinaryInputBasicDescription() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDescriptionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDescriptionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Description response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Description response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6739,111 +7929,133 @@ class SubscribeAttributeBinaryInputBasicDescription : public SubscribeAttribute */ class ReadBinaryInputBasicInactiveText : public ReadAttribute { public: - ReadBinaryInputBasicInactiveText() - : ReadAttribute("inactive-text") - { - } - - ~ReadBinaryInputBasicInactiveText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000002E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInactiveTextWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.InactiveText response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic InactiveText read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicInactiveText() : ReadAttribute("inactive-text") {} + + ~ReadBinaryInputBasicInactiveText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000002E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInactiveTextWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.InactiveText response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic InactiveText read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicInactiveText : public WriteAttribute { public: - WriteBinaryInputBasicInactiveText() - : WriteAttribute("inactive-text") - { - AddArgument("attr-name", "inactive-text"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicInactiveText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x0000002E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeInactiveTextWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic InactiveText write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicInactiveText() : WriteAttribute("inactive-text") { + AddArgument("attr-name", "inactive-text"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicInactiveText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x0000002E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster writeAttributeInactiveTextWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "InactiveText write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; -class SubscribeAttributeBinaryInputBasicInactiveText : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicInactiveText + : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicInactiveText() - : SubscribeAttribute("inactive-text") - { - } + SubscribeAttributeBinaryInputBasicInactiveText() + : SubscribeAttribute("inactive-text") {} - ~SubscribeAttributeBinaryInputBasicInactiveText() {} + ~SubscribeAttributeBinaryInputBasicInactiveText() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000002E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000002E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInactiveTextWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInactiveTextWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.InactiveText response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.InactiveText response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6851,109 +8063,130 @@ class SubscribeAttributeBinaryInputBasicInactiveText : public SubscribeAttribute */ class ReadBinaryInputBasicOutOfService : public ReadAttribute { public: - ReadBinaryInputBasicOutOfService() - : ReadAttribute("out-of-service") - { - } - - ~ReadBinaryInputBasicOutOfService() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000051) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOutOfServiceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.OutOfService response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic OutOfService read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicOutOfService() : ReadAttribute("out-of-service") {} + + ~ReadBinaryInputBasicOutOfService() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000051) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOutOfServiceWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.OutOfService response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic OutOfService read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicOutOfService : public WriteAttribute { public: - WriteBinaryInputBasicOutOfService() - : WriteAttribute("out-of-service") - { - AddArgument("attr-name", "out-of-service"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicOutOfService() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x00000051) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeOutOfServiceWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic OutOfService write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicOutOfService() : WriteAttribute("out-of-service") { + AddArgument("attr-name", "out-of-service"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicOutOfService() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x00000051) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster writeAttributeOutOfServiceWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "OutOfService write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; -class SubscribeAttributeBinaryInputBasicOutOfService : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicOutOfService + : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicOutOfService() - : SubscribeAttribute("out-of-service") - { - } + SubscribeAttributeBinaryInputBasicOutOfService() + : SubscribeAttribute("out-of-service") {} - ~SubscribeAttributeBinaryInputBasicOutOfService() {} + ~SubscribeAttributeBinaryInputBasicOutOfService() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000051) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000051) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOutOfServiceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOutOfServiceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.OutOfService response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.OutOfService response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -6961,69 +8194,77 @@ class SubscribeAttributeBinaryInputBasicOutOfService : public SubscribeAttribute */ class ReadBinaryInputBasicPolarity : public ReadAttribute { public: - ReadBinaryInputBasicPolarity() - : ReadAttribute("polarity") - { - } - - ~ReadBinaryInputBasicPolarity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000054) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePolarityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Polarity response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic Polarity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicPolarity() : ReadAttribute("polarity") {} + + ~ReadBinaryInputBasicPolarity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000054) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePolarityWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Polarity response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic Polarity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeBinaryInputBasicPolarity : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicPolarity() - : SubscribeAttribute("polarity") - { - } + SubscribeAttributeBinaryInputBasicPolarity() + : SubscribeAttribute("polarity") {} - ~SubscribeAttributeBinaryInputBasicPolarity() {} + ~SubscribeAttributeBinaryInputBasicPolarity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000054) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000054) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePolarityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePolarityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Polarity response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Polarity response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -7031,109 +8272,130 @@ class SubscribeAttributeBinaryInputBasicPolarity : public SubscribeAttribute { */ class ReadBinaryInputBasicPresentValue : public ReadAttribute { public: - ReadBinaryInputBasicPresentValue() - : ReadAttribute("present-value") - { - } - - ~ReadBinaryInputBasicPresentValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000055) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePresentValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.PresentValue response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic PresentValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicPresentValue() : ReadAttribute("present-value") {} + + ~ReadBinaryInputBasicPresentValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000055) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePresentValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.PresentValue response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic PresentValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicPresentValue : public WriteAttribute { public: - WriteBinaryInputBasicPresentValue() - : WriteAttribute("present-value") - { - AddArgument("attr-name", "present-value"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicPresentValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x00000055) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributePresentValueWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic PresentValue write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicPresentValue() : WriteAttribute("present-value") { + AddArgument("attr-name", "present-value"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicPresentValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x00000055) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster writeAttributePresentValueWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "PresentValue write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; -class SubscribeAttributeBinaryInputBasicPresentValue : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicPresentValue + : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicPresentValue() - : SubscribeAttribute("present-value") - { - } + SubscribeAttributeBinaryInputBasicPresentValue() + : SubscribeAttribute("present-value") {} - ~SubscribeAttributeBinaryInputBasicPresentValue() {} + ~SubscribeAttributeBinaryInputBasicPresentValue() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000055) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000055) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePresentValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePresentValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.PresentValue response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.PresentValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -7141,109 +8403,130 @@ class SubscribeAttributeBinaryInputBasicPresentValue : public SubscribeAttribute */ class ReadBinaryInputBasicReliability : public ReadAttribute { public: - ReadBinaryInputBasicReliability() - : ReadAttribute("reliability") - { - } - - ~ReadBinaryInputBasicReliability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000067) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReliabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Reliability response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic Reliability read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicReliability() : ReadAttribute("reliability") {} + + ~ReadBinaryInputBasicReliability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000067) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReliabilityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Reliability response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic Reliability read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteBinaryInputBasicReliability : public WriteAttribute { public: - WriteBinaryInputBasicReliability() - : WriteAttribute("reliability") - { - AddArgument("attr-name", "reliability"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBinaryInputBasicReliability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) WriteAttribute (0x00000067) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeReliabilityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BinaryInputBasic Reliability write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteBinaryInputBasicReliability() : WriteAttribute("reliability") { + AddArgument("attr-name", "reliability"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBinaryInputBasicReliability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) WriteAttribute (0x00000067) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeReliabilityWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BinaryInputBasic " + "Reliability write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeBinaryInputBasicReliability : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicReliability + : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicReliability() - : SubscribeAttribute("reliability") - { - } + SubscribeAttributeBinaryInputBasicReliability() + : SubscribeAttribute("reliability") {} - ~SubscribeAttributeBinaryInputBasicReliability() {} + ~SubscribeAttributeBinaryInputBasicReliability() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000067) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000067) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReliabilityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeReliabilityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.Reliability response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.Reliability response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -7251,501 +8534,1300 @@ class SubscribeAttributeBinaryInputBasicReliability : public SubscribeAttribute */ class ReadBinaryInputBasicStatusFlags : public ReadAttribute { public: - ReadBinaryInputBasicStatusFlags() - : ReadAttribute("status-flags") - { - } - - ~ReadBinaryInputBasicStatusFlags() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000006F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStatusFlagsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.StatusFlags response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic StatusFlags read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicStatusFlags() : ReadAttribute("status-flags") {} + + ~ReadBinaryInputBasicStatusFlags() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000006F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStatusFlagsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.StatusFlags response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic StatusFlags read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicStatusFlags + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicStatusFlags() + : SubscribeAttribute("status-flags") {} + + ~SubscribeAttributeBinaryInputBasicStatusFlags() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000006F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStatusFlagsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.StatusFlags response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicStatusFlags : public SubscribeAttribute { +/* + * Attribute ApplicationType + */ +class ReadBinaryInputBasicApplicationType : public ReadAttribute { public: - SubscribeAttributeBinaryInputBasicStatusFlags() - : SubscribeAttribute("status-flags") - { - } - - ~SubscribeAttributeBinaryInputBasicStatusFlags() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000006F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStatusFlagsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.StatusFlags response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBinaryInputBasicApplicationType() : ReadAttribute("application-type") {} + + ~ReadBinaryInputBasicApplicationType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x00000100) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApplicationTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ApplicationType response %@", + [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic ApplicationType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicApplicationType + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicApplicationType() + : SubscribeAttribute("application-type") {} + + ~SubscribeAttributeBinaryInputBasicApplicationType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x00000100) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApplicationTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ApplicationType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ApplicationType + * Attribute GeneratedCommandList */ -class ReadBinaryInputBasicApplicationType : public ReadAttribute { +class ReadBinaryInputBasicGeneratedCommandList : public ReadAttribute { public: - ReadBinaryInputBasicApplicationType() - : ReadAttribute("application-type") - { - } + ReadBinaryInputBasicGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBinaryInputBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBinaryInputBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadBinaryInputBasicApplicationType() {} +/* + * Attribute AcceptedCommandList + */ +class ReadBinaryInputBasicAcceptedCommandList : public ReadAttribute { +public: + ReadBinaryInputBasicAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBinaryInputBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBinaryInputBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x00000100) on endpoint %u", endpointId); +/* + * Attribute AttributeList + */ +class ReadBinaryInputBasicAttributeList : public ReadAttribute { +public: + ReadBinaryInputBasicAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBinaryInputBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeBinaryInputBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApplicationTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ApplicationType response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic ApplicationType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadBinaryInputBasicFeatureMap : public ReadAttribute { +public: + ReadBinaryInputBasicFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBinaryInputBasicFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicApplicationType : public SubscribeAttribute { +class SubscribeAttributeBinaryInputBasicFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicApplicationType() - : SubscribeAttribute("application-type") - { - } + SubscribeAttributeBinaryInputBasicFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeBinaryInputBasicApplicationType() {} + ~SubscribeAttributeBinaryInputBasicFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x00000100) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeApplicationTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ApplicationType response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ClusterRevision */ -class ReadBinaryInputBasicGeneratedCommandList : public ReadAttribute { +class ReadBinaryInputBasicClusterRevision : public ReadAttribute { public: - ReadBinaryInputBasicGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBinaryInputBasicGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); + ReadBinaryInputBasicClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBinaryInputBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("BinaryInputBasic ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBinaryInputBasicClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBinaryInputBasicClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBinaryInputBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BinaryInputBasic.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/*----------------------------------------------------------------------------*\ +| Cluster Descriptor | 0x001D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceTypeList | 0x0000 | +| * ServerList | 0x0001 | +| * ClientList | 0x0002 | +| * PartsList | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Attribute DeviceTypeList + */ +class ReadDescriptorDeviceTypeList : public ReadAttribute { +public: + ReadDescriptorDeviceTypeList() : ReadAttribute("device-type-list") {} + + ~ReadDescriptorDeviceTypeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDeviceTypeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor DeviceTypeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeDescriptorDeviceTypeList : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeDescriptorDeviceTypeList() + : SubscribeAttribute("device-type-list") {} - ~SubscribeAttributeBinaryInputBasicGeneratedCommandList() {} + ~SubscribeAttributeDescriptorDeviceTypeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDeviceTypeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute ServerList */ -class ReadBinaryInputBasicAcceptedCommandList : public ReadAttribute { +class ReadDescriptorServerList : public ReadAttribute { public: - ReadBinaryInputBasicAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBinaryInputBasicAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDescriptorServerList() : ReadAttribute("server-list") {} + + ~ReadDescriptorServerList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeServerListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Descriptor.ServerList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor ServerList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeDescriptorServerList : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeDescriptorServerList() + : SubscribeAttribute("server-list") {} - ~SubscribeAttributeBinaryInputBasicAcceptedCommandList() {} + ~SubscribeAttributeDescriptorServerList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeServerListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.ServerList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute ClientList */ -class ReadBinaryInputBasicAttributeList : public ReadAttribute { +class ReadDescriptorClientList : public ReadAttribute { public: - ReadBinaryInputBasicAttributeList() - : ReadAttribute("attribute-list") - { - } + ReadDescriptorClientList() : ReadAttribute("client-list") {} + + ~ReadDescriptorClientList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClientListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Descriptor.ClientList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor ClientList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadBinaryInputBasicAttributeList() {} +class SubscribeAttributeDescriptorClientList : public SubscribeAttribute { +public: + SubscribeAttributeDescriptorClientList() + : SubscribeAttribute("client-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); + ~SubscribeAttributeDescriptorClientList() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClientListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.ClientList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicAttributeList : public SubscribeAttribute { +/* + * Attribute PartsList + */ +class ReadDescriptorPartsList : public ReadAttribute { public: - SubscribeAttributeBinaryInputBasicAttributeList() - : SubscribeAttribute("attribute-list") - { - } + ReadDescriptorPartsList() : ReadAttribute("parts-list") {} + + ~ReadDescriptorPartsList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePartsListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Descriptor.PartsList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor PartsList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeBinaryInputBasicAttributeList() {} +class SubscribeAttributeDescriptorPartsList : public SubscribeAttribute { +public: + SubscribeAttributeDescriptorPartsList() : SubscribeAttribute("parts-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeDescriptorPartsList() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePartsListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.PartsList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute GeneratedCommandList */ -class ReadBinaryInputBasicFeatureMap : public ReadAttribute { +class ReadDescriptorGeneratedCommandList : public ReadAttribute { public: - ReadBinaryInputBasicFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadBinaryInputBasicFeatureMap() {} + ReadDescriptorGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadDescriptorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("Descriptor GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDescriptorGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDescriptorGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeDescriptorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +/* + * Attribute AcceptedCommandList + */ +class ReadDescriptorAcceptedCommandList : public ReadAttribute { +public: + ReadDescriptorAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadDescriptorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDescriptorAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDescriptorAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeDescriptorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadDescriptorAttributeList : public ReadAttribute { +public: + ReadDescriptorAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadDescriptorAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicFeatureMap : public SubscribeAttribute { +class SubscribeAttributeDescriptorAttributeList : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeDescriptorAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeBinaryInputBasicFeatureMap() {} + ~SubscribeAttributeDescriptorAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute FeatureMap */ -class ReadBinaryInputBasicClusterRevision : public ReadAttribute { +class ReadDescriptorFeatureMap : public ReadAttribute { public: - ReadBinaryInputBasicClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadDescriptorFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadDescriptorFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Descriptor.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadBinaryInputBasicClusterRevision() {} +class SubscribeAttributeDescriptorFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeDescriptorFeatureMap() + : SubscribeAttribute("feature-map") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeDescriptorFeatureMap() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BinaryInputBasic ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadDescriptorClusterRevision : public ReadAttribute { +public: + ReadDescriptorClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadDescriptorClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Descriptor ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBinaryInputBasicClusterRevision : public SubscribeAttribute { +class SubscribeAttributeDescriptorClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeBinaryInputBasicClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeDescriptorClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeBinaryInputBasicClusterRevision() {} + ~SubscribeAttributeDescriptorClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000000F) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinaryInputBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BinaryInputBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Descriptor.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster Descriptor | 0x001D | +| Cluster Binding | 0x001E | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | -| * DeviceTypeList | 0x0000 | -| * ServerList | 0x0001 | -| * ClientList | 0x0002 | -| * PartsList | 0x0003 | +| * Binding | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -7756,642 +9838,1621 @@ class SubscribeAttributeBinaryInputBasicClusterRevision : public SubscribeAttrib \*----------------------------------------------------------------------------*/ /* - * Attribute DeviceTypeList + * Attribute Binding */ -class ReadDescriptorDeviceTypeList : public ReadAttribute { +class ReadBindingBinding : public ReadAttribute { public: - ReadDescriptorDeviceTypeList() - : ReadAttribute("device-type-list") - { - } + ReadBindingBinding() : ReadAttribute("binding") {} + + ~ReadBindingBinding() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeBindingWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Binding.Binding response %@", + [value description]); + if (error != nil) { + LogNSError("Binding Binding read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadDescriptorDeviceTypeList() {} +class WriteBindingBinding : public WriteAttribute { +public: + WriteBindingBinding() : WriteAttribute("binding"), mComplex(&mValue) { + AddArgument("attr-name", "binding"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteBindingBinding() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRBindingClusterTargetStruct *newElement_0; + newElement_0 = [MTRBindingClusterTargetStruct new]; + if (entry_0.node.HasValue()) { + newElement_0.node = + [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; + } else { + newElement_0.node = nil; + } + if (entry_0.group.HasValue()) { + newElement_0.group = + [NSNumber numberWithUnsignedShort:entry_0.group.Value()]; + } else { + newElement_0.group = nil; + } + if (entry_0.endpoint.HasValue()) { + newElement_0.endpoint = + [NSNumber numberWithUnsignedShort:entry_0.endpoint.Value()]; + } else { + newElement_0.endpoint = nil; + } + if (entry_0.cluster.HasValue()) { + newElement_0.cluster = + [NSNumber numberWithUnsignedInt:entry_0.cluster.Value()]; + } else { + newElement_0.cluster = nil; + } + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x00000000) on endpoint %u", endpointId); + [cluster writeAttributeBindingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("Binding Binding write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDeviceTypeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor DeviceTypeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::DataModel::List< + const chip::app::Clusters::Binding::Structs::TargetStruct::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeDescriptorDeviceTypeList : public SubscribeAttribute { +class SubscribeAttributeBindingBinding : public SubscribeAttribute { public: - SubscribeAttributeDescriptorDeviceTypeList() - : SubscribeAttribute("device-type-list") - { - } + SubscribeAttributeBindingBinding() : SubscribeAttribute("binding") {} - ~SubscribeAttributeDescriptorDeviceTypeList() {} + ~SubscribeAttributeBindingBinding() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBindingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDeviceTypeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.Binding response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ServerList + * Attribute GeneratedCommandList */ -class ReadDescriptorServerList : public ReadAttribute { +class ReadBindingGeneratedCommandList : public ReadAttribute { public: - ReadDescriptorServerList() - : ReadAttribute("server-list") - { - } - - ~ReadDescriptorServerList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x00000001) on endpoint %u", endpointId); + ReadBindingGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadBindingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Binding GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBindingGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBindingGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBindingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeServerListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ServerList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor ServerList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadBindingAcceptedCommandList : public ReadAttribute { +public: + ReadBindingAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadBindingAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Binding AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorServerList : public SubscribeAttribute { +class SubscribeAttributeBindingAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeDescriptorServerList() - : SubscribeAttribute("server-list") - { - } + SubscribeAttributeBindingAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeDescriptorServerList() {} + ~SubscribeAttributeBindingAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeServerListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ServerList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClientList + * Attribute AttributeList */ -class ReadDescriptorClientList : public ReadAttribute { +class ReadBindingAttributeList : public ReadAttribute { public: - ReadDescriptorClientList() - : ReadAttribute("client-list") - { - } - - ~ReadDescriptorClientList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClientListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ClientList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor ClientList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBindingAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBindingAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Binding AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorClientList : public SubscribeAttribute { +class SubscribeAttributeBindingAttributeList : public SubscribeAttribute { public: - SubscribeAttributeDescriptorClientList() - : SubscribeAttribute("client-list") - { - } + SubscribeAttributeBindingAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeDescriptorClientList() {} + ~SubscribeAttributeBindingAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClientListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ClientList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PartsList + * Attribute FeatureMap */ -class ReadDescriptorPartsList : public ReadAttribute { +class ReadBindingFeatureMap : public ReadAttribute { public: - ReadDescriptorPartsList() - : ReadAttribute("parts-list") - { - } - - ~ReadDescriptorPartsList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePartsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.PartsList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor PartsList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBindingFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBindingFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Binding.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Binding FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorPartsList : public SubscribeAttribute { +class SubscribeAttributeBindingFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeDescriptorPartsList() - : SubscribeAttribute("parts-list") - { - } + SubscribeAttributeBindingFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeDescriptorPartsList() {} + ~SubscribeAttributeBindingFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePartsListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.PartsList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ClusterRevision */ -class ReadDescriptorGeneratedCommandList : public ReadAttribute { +class ReadBindingClusterRevision : public ReadAttribute { public: - ReadDescriptorGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadDescriptorGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBindingClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBindingClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Binding ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeDescriptorGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeBindingClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeDescriptorGeneratedCommandList() {} + ~SubscribeAttributeBindingClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBinding alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Binding.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster AccessControl | 0x001F | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Acl | 0x0000 | +| * Extension | 0x0001 | +| * SubjectsPerAccessControlEntry | 0x0002 | +| * TargetsPerAccessControlEntry | 0x0003 | +| * AccessControlEntriesPerFabric | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * AccessControlEntryChanged | 0x0000 | +| * AccessControlExtensionChanged | 0x0001 | +\*----------------------------------------------------------------------------*/ + /* - * Attribute AcceptedCommandList + * Attribute Acl */ -class ReadDescriptorAcceptedCommandList : public ReadAttribute { +class ReadAccessControlAcl : public ReadAttribute { public: - ReadDescriptorAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadDescriptorAcceptedCommandList() {} + ReadAccessControlAcl() : ReadAttribute("acl") {} + + ~ReadAccessControlAcl() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeACLWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AccessControl.ACL response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl ACL read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteAccessControlAcl : public WriteAttribute { +public: + WriteAccessControlAcl() : WriteAttribute("acl"), mComplex(&mValue) { + AddArgument("attr-name", "acl"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteAccessControlAcl() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRAccessControlClusterAccessControlEntry *newElement_0; + newElement_0 = [MTRAccessControlClusterAccessControlEntry new]; + newElement_0.privilege = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; + newElement_0.authMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; + if (entry_0.subjects.IsNull()) { + newElement_0.subjects = nil; + } else { + { // Scope for our temporary variables + auto *array_3 = [NSMutableArray new]; + for (auto &entry_3 : entry_0.subjects.Value()) { + NSNumber *newElement_3; + newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; + [array_3 addObject:newElement_3]; + } + newElement_0.subjects = array_3; + } + } + if (entry_0.targets.IsNull()) { + newElement_0.targets = nil; + } else { + { // Scope for our temporary variables + auto *array_3 = [NSMutableArray new]; + for (auto &entry_3 : entry_0.targets.Value()) { + MTRAccessControlClusterTarget *newElement_3; + newElement_3 = [MTRAccessControlClusterTarget new]; + if (entry_3.cluster.IsNull()) { + newElement_3.cluster = nil; + } else { + newElement_3.cluster = + [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; + } + if (entry_3.endpoint.IsNull()) { + newElement_3.endpoint = nil; + } else { + newElement_3.endpoint = + [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; + } + if (entry_3.deviceType.IsNull()) { + newElement_3.deviceType = nil; + } else { + newElement_3.deviceType = + [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; + } + [array_3 addObject:newElement_3]; + } + newElement_0.targets = array_3; + } + } + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeACLWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("AccessControl ACL write Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::DataModel::List + mValue; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex; }; -class SubscribeAttributeDescriptorAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeAccessControlAcl : public SubscribeAttribute { public: - SubscribeAttributeDescriptorAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeAccessControlAcl() : SubscribeAttribute("acl") {} - ~SubscribeAttributeDescriptorAcceptedCommandList() {} + ~SubscribeAttributeAccessControlAcl() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACLWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.ACL response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute Extension */ -class ReadDescriptorAttributeList : public ReadAttribute { +class ReadAccessControlExtension : public ReadAttribute { public: - ReadDescriptorAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadDescriptorAttributeList() {} + ReadAccessControlExtension() : ReadAttribute("extension") {} + + ~ReadAccessControlExtension() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeExtensionWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AccessControl.Extension response %@", + [value description]); + if (error != nil) { + LogNSError( + "AccessControl Extension read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteAccessControlExtension : public WriteAttribute { +public: + WriteAccessControlExtension() + : WriteAttribute("extension"), mComplex(&mValue) { + AddArgument("attr-name", "extension"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteAccessControlExtension() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRAccessControlClusterExtensionEntry *newElement_0; + newElement_0 = [MTRAccessControlClusterExtensionEntry new]; + newElement_0.data = [NSData dataWithBytes:entry_0.data.data() + length:entry_0.data.size()]; + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeExtensionWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "AccessControl Extension write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::DataModel::List< + const chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeDescriptorAttributeList : public SubscribeAttribute { +class SubscribeAttributeAccessControlExtension : public SubscribeAttribute { public: - SubscribeAttributeDescriptorAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeAccessControlExtension() + : SubscribeAttribute("extension") {} - ~SubscribeAttributeDescriptorAttributeList() {} + ~SubscribeAttributeAccessControlExtension() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExtensionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.Extension response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute SubjectsPerAccessControlEntry */ -class ReadDescriptorFeatureMap : public ReadAttribute { +class ReadAccessControlSubjectsPerAccessControlEntry : public ReadAttribute { public: - ReadDescriptorFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadDescriptorFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAccessControlSubjectsPerAccessControlEntry() + : ReadAttribute("subjects-per-access-control-entry") {} + + ~ReadAccessControlSubjectsPerAccessControlEntry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSubjectsPerAccessControlEntryWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl SubjectsPerAccessControlEntry read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlSubjectsPerAccessControlEntry + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() + : SubscribeAttribute("subjects-per-access-control-entry") {} + + ~SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSubjectsPerAccessControlEntryWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorFeatureMap : public SubscribeAttribute { +/* + * Attribute TargetsPerAccessControlEntry + */ +class ReadAccessControlTargetsPerAccessControlEntry : public ReadAttribute { public: - SubscribeAttributeDescriptorFeatureMap() - : SubscribeAttribute("feature-map") - { - } + ReadAccessControlTargetsPerAccessControlEntry() + : ReadAttribute("targets-per-access-control-entry") {} + + ~ReadAccessControlTargetsPerAccessControlEntry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTargetsPerAccessControlEntryWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl TargetsPerAccessControlEntry read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlTargetsPerAccessControlEntry + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlTargetsPerAccessControlEntry() + : SubscribeAttribute("targets-per-access-control-entry") {} + + ~SubscribeAttributeAccessControlTargetsPerAccessControlEntry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTargetsPerAccessControlEntryWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeDescriptorFeatureMap() {} +/* + * Attribute AccessControlEntriesPerFabric + */ +class ReadAccessControlAccessControlEntriesPerFabric : public ReadAttribute { +public: + ReadAccessControlAccessControlEntriesPerFabric() + : ReadAttribute("access-control-entries-per-fabric") {} + + ~ReadAccessControlAccessControlEntriesPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAccessControlEntriesPerFabricWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl AccessControlEntriesPerFabric read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlAccessControlEntriesPerFabric + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlAccessControlEntriesPerFabric() + : SubscribeAttribute("access-control-entries-per-fabric") {} + + ~SubscribeAttributeAccessControlAccessControlEntriesPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAccessControlEntriesPerFabricWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute GeneratedCommandList + */ +class ReadAccessControlGeneratedCommandList : public ReadAttribute { +public: + ReadAccessControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadAccessControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeAccessControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadAccessControlAcceptedCommandList : public ReadAttribute { +public: + ReadAccessControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadAccessControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AccessControl AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeAccessControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute AttributeList */ -class ReadDescriptorClusterRevision : public ReadAttribute { +class ReadAccessControlAttributeList : public ReadAttribute { public: - ReadDescriptorClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadAccessControlAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadAccessControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("AccessControl AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadDescriptorClusterRevision() {} +class SubscribeAttributeAccessControlAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlAttributeList() + : SubscribeAttribute("attribute-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeAccessControlAttributeList() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Descriptor ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDescriptorClusterRevision : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadAccessControlFeatureMap : public ReadAttribute { public: - SubscribeAttributeDescriptorClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadAccessControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadAccessControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AccessControl.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("AccessControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeDescriptorClusterRevision() {} +class SubscribeAttributeAccessControlFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlFeatureMap() + : SubscribeAttribute("feature-map") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001D) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Descriptor.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeAccessControlFeatureMap() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadAccessControlClusterRevision : public ReadAttribute { +public: + ReadAccessControlClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadAccessControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("AccessControl ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeAccessControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccessControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccessControl.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster Binding | 0x001E | +| Cluster Actions | 0x0025 | |------------------------------------------------------------------------------| | Commands: | | +| * InstantAction | 0x00 | +| * InstantActionWithTransition | 0x01 | +| * StartAction | 0x02 | +| * StartActionWithDuration | 0x03 | +| * StopAction | 0x04 | +| * PauseAction | 0x05 | +| * PauseActionWithDuration | 0x06 | +| * ResumeAction | 0x07 | +| * EnableAction | 0x08 | +| * EnableActionWithDuration | 0x09 | +| * DisableAction | 0x0A | +| * DisableActionWithDuration | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | -| * Binding | 0x0000 | +| * ActionList | 0x0000 | +| * EndpointLists | 0x0001 | +| * SetupURL | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -8399,2558 +11460,5186 @@ class SubscribeAttributeDescriptorClusterRevision : public SubscribeAttribute { | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * StateChanged | 0x0000 | +| * ActionFailed | 0x0001 | \*----------------------------------------------------------------------------*/ /* - * Attribute Binding + * Command InstantAction */ -class ReadBindingBinding : public ReadAttribute { +class ActionsInstantAction : public ClusterCommand { public: - ReadBindingBinding() - : ReadAttribute("binding") - { + ActionsInstantAction() : ClusterCommand("instant-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterInstantActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster instantActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadBindingBinding() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeBindingWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.Binding response %@", [value description]); - if (error != nil) { - LogNSError("Binding Binding read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::Actions::Commands::InstantAction::Type mRequest; }; -class WriteBindingBinding : public WriteAttribute { -public: - WriteBindingBinding() - : WriteAttribute("binding") - , mComplex(&mValue) - { - AddArgument("attr-name", "binding"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteBindingBinding() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRBindingClusterTargetStruct * newElement_0; - newElement_0 = [MTRBindingClusterTargetStruct new]; - if (entry_0.node.HasValue()) { - newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; - } else { - newElement_0.node = nil; - } - if (entry_0.group.HasValue()) { - newElement_0.group = [NSNumber numberWithUnsignedShort:entry_0.group.Value()]; - } else { - newElement_0.group = nil; - } - if (entry_0.endpoint.HasValue()) { - newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint.Value()]; - } else { - newElement_0.endpoint = nil; - } - if (entry_0.cluster.HasValue()) { - newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster.Value()]; - } else { - newElement_0.cluster = nil; - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeBindingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Binding Binding write Error", error); - } - SetCommandExitStatus(error); +/* + * Command InstantActionWithTransition + */ +class ActionsInstantActionWithTransition : public ClusterCommand { +public: + ActionsInstantActionWithTransition() + : ClusterCommand("instant-action-with-transition") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRActionsClusterInstantActionWithTransitionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + instantActionWithTransitionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } }]; - return CHIP_NO_ERROR; } + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Type + mRequest; }; -class SubscribeAttributeBindingBinding : public SubscribeAttribute { +/* + * Command StartAction + */ +class ActionsStartAction : public ClusterCommand { public: - SubscribeAttributeBindingBinding() - : SubscribeAttribute("binding") - { + ActionsStartAction() : ClusterCommand("start-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterStartActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster startActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeBindingBinding() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBindingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.Binding response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::Actions::Commands::StartAction::Type mRequest; }; /* - * Attribute GeneratedCommandList + * Command StartActionWithDuration */ -class ReadBindingGeneratedCommandList : public ReadAttribute { +class ActionsStartActionWithDuration : public ClusterCommand { public: - ReadBindingGeneratedCommandList() - : ReadAttribute("generated-command-list") - { + ActionsStartActionWithDuration() + : ClusterCommand("start-action-with-duration") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRActionsClusterStartActionWithDurationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster startActionWithDurationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadBindingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +private: + chip::app::Clusters::Actions::Commands::StartActionWithDuration::Type + mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Binding GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command StopAction + */ +class ActionsStopAction : public ClusterCommand { +public: + ActionsStopAction() : ClusterCommand("stop-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterStopActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Actions::Commands::StopAction::Type mRequest; }; -class SubscribeAttributeBindingGeneratedCommandList : public SubscribeAttribute { +/* + * Command PauseAction + */ +class ActionsPauseAction : public ClusterCommand { public: - SubscribeAttributeBindingGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + ActionsPauseAction() : ClusterCommand("pause-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterPauseActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster pauseActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeBindingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; +private: + chip::app::Clusters::Actions::Commands::PauseAction::Type mRequest; +}; - return CHIP_NO_ERROR; +/* + * Command PauseActionWithDuration + */ +class ActionsPauseActionWithDuration : public ClusterCommand { +public: + ActionsPauseActionWithDuration() + : ClusterCommand("pause-action-with-duration") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRActionsClusterPauseActionWithDurationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster pauseActionWithDurationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Type + mRequest; }; /* - * Attribute AcceptedCommandList + * Command ResumeAction */ -class ReadBindingAcceptedCommandList : public ReadAttribute { +class ActionsResumeAction : public ClusterCommand { public: - ReadBindingAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + ActionsResumeAction() : ClusterCommand("resume-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterResumeActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster resumeActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadBindingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +private: + chip::app::Clusters::Actions::Commands::ResumeAction::Type mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Binding AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command EnableAction + */ +class ActionsEnableAction : public ClusterCommand { +public: + ActionsEnableAction() : ClusterCommand("enable-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterEnableActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster enableActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Actions::Commands::EnableAction::Type mRequest; }; -class SubscribeAttributeBindingAcceptedCommandList : public SubscribeAttribute { +/* + * Command EnableActionWithDuration + */ +class ActionsEnableActionWithDuration : public ClusterCommand { public: - SubscribeAttributeBindingAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { + ActionsEnableActionWithDuration() + : ClusterCommand("enable-action-with-duration") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x00000009) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRActionsClusterEnableActionWithDurationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster enableActionWithDurationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeBindingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; +private: + chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Type + mRequest; +}; - return CHIP_NO_ERROR; +/* + * Command DisableAction + */ +class ActionsDisableAction : public ClusterCommand { +public: + ActionsDisableAction() : ClusterCommand("disable-action") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x0000000A) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRActionsClusterDisableActionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster disableActionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Actions::Commands::DisableAction::Type mRequest; }; /* - * Attribute AttributeList + * Command DisableActionWithDuration */ -class ReadBindingAttributeList : public ReadAttribute { +class ActionsDisableActionWithDuration : public ClusterCommand { public: - ReadBindingAttributeList() - : ReadAttribute("attribute-list") - { + ActionsDisableActionWithDuration() + : ClusterCommand("disable-action-with-duration") { + AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); + AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000025) command (0x0000000B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRActionsClusterDisableActionWithDurationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; + if (mRequest.invokeID.HasValue()) { + params.invokeID = + [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; + } else { + params.invokeID = nil; + } + params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster disableActionWithDurationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadBindingAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +private: + chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Type + mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Binding AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ActionList + */ +class ReadActionsActionList : public ReadAttribute { +public: + ReadActionsActionList() : ReadAttribute("action-list") {} + + ~ReadActionsActionList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActionListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Actions.ActionList response %@", [value description]); + if (error != nil) { + LogNSError("Actions ActionList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBindingAttributeList : public SubscribeAttribute { +class SubscribeAttributeActionsActionList : public SubscribeAttribute { public: - SubscribeAttributeBindingAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeActionsActionList() : SubscribeAttribute("action-list") {} - ~SubscribeAttributeBindingAttributeList() {} + ~SubscribeAttributeActionsActionList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActionListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.ActionList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute EndpointLists */ -class ReadBindingFeatureMap : public ReadAttribute { +class ReadActionsEndpointLists : public ReadAttribute { public: - ReadBindingFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadBindingFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Binding FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadActionsEndpointLists() : ReadAttribute("endpoint-lists") {} + + ~ReadActionsEndpointLists() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEndpointListsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.EndpointLists response %@", [value description]); + if (error != nil) { + LogNSError("Actions EndpointLists read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBindingFeatureMap : public SubscribeAttribute { +class SubscribeAttributeActionsEndpointLists : public SubscribeAttribute { public: - SubscribeAttributeBindingFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeActionsEndpointLists() + : SubscribeAttribute("endpoint-lists") {} - ~SubscribeAttributeBindingFeatureMap() {} + ~SubscribeAttributeActionsEndpointLists() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEndpointListsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.EndpointLists response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute SetupURL */ -class ReadBindingClusterRevision : public ReadAttribute { +class ReadActionsSetupURL : public ReadAttribute { public: - ReadBindingClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadActionsSetupURL() : ReadAttribute("setup-url") {} + + ~ReadActionsSetupURL() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSetupURLWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Actions.SetupURL response %@", [value description]); + if (error != nil) { + LogNSError("Actions SetupURL read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadBindingClusterRevision() {} +class SubscribeAttributeActionsSetupURL : public SubscribeAttribute { +public: + SubscribeAttributeActionsSetupURL() : SubscribeAttribute("setup-url") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeActionsSetupURL() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Binding ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeBindingClusterRevision() - : SubscribeAttribute("cluster-revision") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeBindingClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001E) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSetupURLWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Binding.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.SetupURL response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster AccessControl | 0x001F | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * Acl | 0x0000 | -| * Extension | 0x0001 | -| * SubjectsPerAccessControlEntry | 0x0002 | -| * TargetsPerAccessControlEntry | 0x0003 | -| * AccessControlEntriesPerFabric | 0x0004 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * AccessControlEntryChanged | 0x0000 | -| * AccessControlExtensionChanged | 0x0001 | -\*----------------------------------------------------------------------------*/ - /* - * Attribute Acl + * Attribute GeneratedCommandList */ -class ReadAccessControlAcl : public ReadAttribute { +class ReadActionsGeneratedCommandList : public ReadAttribute { public: - ReadAccessControlAcl() - : ReadAttribute("acl") - { - } - - ~ReadAccessControlAcl() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeACLWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.ACL response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl ACL read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadActionsGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadActionsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Actions GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeActionsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeActionsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeActionsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteAccessControlAcl : public WriteAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadActionsAcceptedCommandList : public ReadAttribute { public: - WriteAccessControlAcl() - : WriteAttribute("acl") - , mComplex(&mValue) - { - AddArgument("attr-name", "acl"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteAccessControlAcl() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRAccessControlClusterAccessControlEntry * newElement_0; - newElement_0 = [MTRAccessControlClusterAccessControlEntry new]; - newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; - newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; - if (entry_0.subjects.IsNull()) { - newElement_0.subjects = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.subjects.Value()) { - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; - [array_3 addObject:newElement_3]; - } - newElement_0.subjects = array_3; - } - } - if (entry_0.targets.IsNull()) { - newElement_0.targets = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.targets.Value()) { - MTRAccessControlClusterTarget * newElement_3; - newElement_3 = [MTRAccessControlClusterTarget new]; - if (entry_3.cluster.IsNull()) { - newElement_3.cluster = nil; - } else { - newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; - } - if (entry_3.endpoint.IsNull()) { - newElement_3.endpoint = nil; - } else { - newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; - } - if (entry_3.deviceType.IsNull()) { - newElement_3.deviceType = nil; - } else { - newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; - } - [array_3 addObject:newElement_3]; - } - newElement_0.targets = array_3; - } - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeACLWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("AccessControl ACL write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::app::DataModel::List mValue; - TypedComplexArgument> - mComplex; + ReadActionsAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadActionsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Actions AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlAcl : public SubscribeAttribute { +class SubscribeAttributeActionsAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeAccessControlAcl() - : SubscribeAttribute("acl") - { - } + SubscribeAttributeActionsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeAccessControlAcl() {} + ~SubscribeAttributeActionsAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeACLWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.ACL response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Extension + * Attribute AttributeList */ -class ReadAccessControlExtension : public ReadAttribute { +class ReadActionsAttributeList : public ReadAttribute { public: - ReadAccessControlExtension() - : ReadAttribute("extension") - { - } + ReadActionsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadActionsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Actions AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadAccessControlExtension() {} +class SubscribeAttributeActionsAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeActionsAttributeList() + : SubscribeAttribute("attribute-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x00000001) on endpoint %u", endpointId); + ~SubscribeAttributeActionsAttributeList() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeExtensionWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.Extension response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl Extension read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class WriteAccessControlExtension : public WriteAttribute { -public: - WriteAccessControlExtension() - : WriteAttribute("extension") - , mComplex(&mValue) - { - AddArgument("attr-name", "extension"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteAccessControlExtension() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRAccessControlClusterExtensionEntry * newElement_0; - newElement_0 = [MTRAccessControlClusterExtensionEntry new]; - newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - [cluster writeAttributeExtensionWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("AccessControl Extension write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } +}; -private: - chip::app::DataModel::List mValue; - TypedComplexArgument> - mComplex; +/* + * Attribute FeatureMap + */ +class ReadActionsFeatureMap : public ReadAttribute { +public: + ReadActionsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadActionsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Actions.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Actions FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlExtension : public SubscribeAttribute { +class SubscribeAttributeActionsFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeAccessControlExtension() - : SubscribeAttribute("extension") - { - } + SubscribeAttributeActionsFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeAccessControlExtension() {} + ~SubscribeAttributeActionsFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeExtensionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.Extension response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SubjectsPerAccessControlEntry + * Attribute ClusterRevision */ -class ReadAccessControlSubjectsPerAccessControlEntry : public ReadAttribute { +class ReadActionsClusterRevision : public ReadAttribute { public: - ReadAccessControlSubjectsPerAccessControlEntry() - : ReadAttribute("subjects-per-access-control-entry") - { - } - - ~ReadAccessControlSubjectsPerAccessControlEntry() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSubjectsPerAccessControlEntryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl SubjectsPerAccessControlEntry read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadActionsClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadActionsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Actions ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlSubjectsPerAccessControlEntry : public SubscribeAttribute { +class SubscribeAttributeActionsClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() - : SubscribeAttribute("subjects-per-access-control-entry") - { - } + SubscribeAttributeActionsClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() {} + ~SubscribeAttributeActionsClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000025) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterActions alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSubjectsPerAccessControlEntryWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Actions.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster BasicInformation | 0x0028 | +|------------------------------------------------------------------------------| +| Commands: | | +| * MfgSpecificPing | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DataModelRevision | 0x0000 | +| * VendorName | 0x0001 | +| * VendorID | 0x0002 | +| * ProductName | 0x0003 | +| * ProductID | 0x0004 | +| * NodeLabel | 0x0005 | +| * Location | 0x0006 | +| * HardwareVersion | 0x0007 | +| * HardwareVersionString | 0x0008 | +| * SoftwareVersion | 0x0009 | +| * SoftwareVersionString | 0x000A | +| * ManufacturingDate | 0x000B | +| * PartNumber | 0x000C | +| * ProductURL | 0x000D | +| * ProductLabel | 0x000E | +| * SerialNumber | 0x000F | +| * LocalConfigDisabled | 0x0010 | +| * Reachable | 0x0011 | +| * UniqueID | 0x0012 | +| * CapabilityMinima | 0x0013 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * StartUp | 0x0000 | +| * ShutDown | 0x0001 | +| * Leave | 0x0002 | +| * ReachableChanged | 0x0003 | +\*----------------------------------------------------------------------------*/ + /* - * Attribute TargetsPerAccessControlEntry + * Attribute DataModelRevision */ -class ReadAccessControlTargetsPerAccessControlEntry : public ReadAttribute { +class ReadBasicInformationDataModelRevision : public ReadAttribute { public: - ReadAccessControlTargetsPerAccessControlEntry() - : ReadAttribute("targets-per-access-control-entry") - { - } - - ~ReadAccessControlTargetsPerAccessControlEntry() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x00000003) on endpoint %u", endpointId); + ReadBasicInformationDataModelRevision() + : ReadAttribute("data-model-revision") {} + + ~ReadBasicInformationDataModelRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDataModelRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.DataModelRevision response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation DataModelRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationDataModelRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationDataModelRevision() + : SubscribeAttribute("data-model-revision") {} + + ~SubscribeAttributeBasicInformationDataModelRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDataModelRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.DataModelRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTargetsPerAccessControlEntryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl TargetsPerAccessControlEntry read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute VendorName + */ +class ReadBasicInformationVendorName : public ReadAttribute { +public: + ReadBasicInformationVendorName() : ReadAttribute("vendor-name") {} + + ~ReadBasicInformationVendorName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorNameWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.VendorName response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation VendorName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlTargetsPerAccessControlEntry : public SubscribeAttribute { +class SubscribeAttributeBasicInformationVendorName : public SubscribeAttribute { public: - SubscribeAttributeAccessControlTargetsPerAccessControlEntry() - : SubscribeAttribute("targets-per-access-control-entry") - { - } + SubscribeAttributeBasicInformationVendorName() + : SubscribeAttribute("vendor-name") {} - ~SubscribeAttributeAccessControlTargetsPerAccessControlEntry() {} + ~SubscribeAttributeBasicInformationVendorName() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTargetsPerAccessControlEntryWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.VendorName response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AccessControlEntriesPerFabric + * Attribute VendorID */ -class ReadAccessControlAccessControlEntriesPerFabric : public ReadAttribute { +class ReadBasicInformationVendorID : public ReadAttribute { public: - ReadAccessControlAccessControlEntriesPerFabric() - : ReadAttribute("access-control-entries-per-fabric") - { - } - - ~ReadAccessControlAccessControlEntriesPerFabric() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAccessControlEntriesPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl AccessControlEntriesPerFabric read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBasicInformationVendorID() : ReadAttribute("vendor-id") {} + + ~ReadBasicInformationVendorID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorIDWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.VendorID response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation VendorID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlAccessControlEntriesPerFabric : public SubscribeAttribute { +class SubscribeAttributeBasicInformationVendorID : public SubscribeAttribute { public: - SubscribeAttributeAccessControlAccessControlEntriesPerFabric() - : SubscribeAttribute("access-control-entries-per-fabric") - { - } + SubscribeAttributeBasicInformationVendorID() + : SubscribeAttribute("vendor-id") {} - ~SubscribeAttributeAccessControlAccessControlEntriesPerFabric() {} + ~SubscribeAttributeBasicInformationVendorID() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAccessControlEntriesPerFabricWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.VendorID response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ProductName */ -class ReadAccessControlGeneratedCommandList : public ReadAttribute { +class ReadBasicInformationProductName : public ReadAttribute { public: - ReadAccessControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadAccessControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBasicInformationProductName() : ReadAttribute("product-name") {} + + ~ReadBasicInformationProductName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductNameWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductName response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation ProductName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationProductName + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationProductName() + : SubscribeAttribute("product-name") {} + + ~SubscribeAttributeBasicInformationProductName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductName response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAccessControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } +/* + * Attribute ProductID + */ +class ReadBasicInformationProductID : public ReadAttribute { +public: + ReadBasicInformationProductID() : ReadAttribute("product-id") {} + + ~ReadBasicInformationProductID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductIDWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductID response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation ProductID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeAccessControlGeneratedCommandList() {} +class SubscribeAttributeBasicInformationProductID : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationProductID() + : SubscribeAttribute("product-id") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeBasicInformationProductID() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductID response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute NodeLabel */ -class ReadAccessControlAcceptedCommandList : public ReadAttribute { +class ReadBasicInformationNodeLabel : public ReadAttribute { public: - ReadAccessControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadAccessControlAcceptedCommandList() {} + ReadBasicInformationNodeLabel() : ReadAttribute("node-label") {} + + ~ReadBasicInformationNodeLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNodeLabelWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.NodeLabel response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation NodeLabel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteBasicInformationNodeLabel : public WriteAttribute { +public: + WriteBasicInformationNodeLabel() : WriteAttribute("node-label") { + AddArgument("attr-name", "node-label"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBasicInformationNodeLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeNodeLabelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BasicInformation NodeLabel write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeAccessControlAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeBasicInformationNodeLabel : public SubscribeAttribute { public: - SubscribeAttributeAccessControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeBasicInformationNodeLabel() + : SubscribeAttribute("node-label") {} - ~SubscribeAttributeAccessControlAcceptedCommandList() {} + ~SubscribeAttributeBasicInformationNodeLabel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNodeLabelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.NodeLabel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute Location */ -class ReadAccessControlAttributeList : public ReadAttribute { +class ReadBasicInformationLocation : public ReadAttribute { public: - ReadAccessControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadAccessControlAttributeList() {} + ReadBasicInformationLocation() : ReadAttribute("location") {} + + ~ReadBasicInformationLocation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocationWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.Location response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation Location read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteBasicInformationLocation : public WriteAttribute { +public: + WriteBasicInformationLocation() : WriteAttribute("location") { + AddArgument("attr-name", "location"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBasicInformationLocation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) WriteAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeLocationWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BasicInformation Location write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeAccessControlAttributeList : public SubscribeAttribute { +class SubscribeAttributeBasicInformationLocation : public SubscribeAttribute { public: - SubscribeAttributeAccessControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeBasicInformationLocation() + : SubscribeAttribute("location") {} - ~SubscribeAttributeAccessControlAttributeList() {} + ~SubscribeAttributeBasicInformationLocation() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.Location response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute HardwareVersion */ -class ReadAccessControlFeatureMap : public ReadAttribute { +class ReadBasicInformationHardwareVersion : public ReadAttribute { public: - ReadAccessControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadAccessControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBasicInformationHardwareVersion() : ReadAttribute("hardware-version") {} + + ~ReadBasicInformationHardwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHardwareVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.HardwareVersion response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation HardwareVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationHardwareVersion + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationHardwareVersion() + : SubscribeAttribute("hardware-version") {} + + ~SubscribeAttributeBasicInformationHardwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHardwareVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.HardwareVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlFeatureMap : public SubscribeAttribute { +/* + * Attribute HardwareVersionString + */ +class ReadBasicInformationHardwareVersionString : public ReadAttribute { public: - SubscribeAttributeAccessControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } + ReadBasicInformationHardwareVersionString() + : ReadAttribute("hardware-version-string") {} + + ~ReadBasicInformationHardwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHardwareVersionStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.HardwareVersionString response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation HardwareVersionString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationHardwareVersionString + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationHardwareVersionString() + : SubscribeAttribute("hardware-version-string") {} + + ~SubscribeAttributeBasicInformationHardwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHardwareVersionStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.HardwareVersionString response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeAccessControlFeatureMap() {} +/* + * Attribute SoftwareVersion + */ +class ReadBasicInformationSoftwareVersion : public ReadAttribute { +public: + ReadBasicInformationSoftwareVersion() : ReadAttribute("software-version") {} + + ~ReadBasicInformationSoftwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSoftwareVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SoftwareVersion response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation SoftwareVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationSoftwareVersion + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationSoftwareVersion() + : SubscribeAttribute("software-version") {} + + ~SubscribeAttributeBasicInformationSoftwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSoftwareVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SoftwareVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute SoftwareVersionString + */ +class ReadBasicInformationSoftwareVersionString : public ReadAttribute { +public: + ReadBasicInformationSoftwareVersionString() + : ReadAttribute("software-version-string") {} + + ~ReadBasicInformationSoftwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSoftwareVersionStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SoftwareVersionString response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation SoftwareVersionString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationSoftwareVersionString + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationSoftwareVersionString() + : SubscribeAttribute("software-version-string") {} + + ~SubscribeAttributeBasicInformationSoftwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSoftwareVersionStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SoftwareVersionString response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ManufacturingDate + */ +class ReadBasicInformationManufacturingDate : public ReadAttribute { +public: + ReadBasicInformationManufacturingDate() + : ReadAttribute("manufacturing-date") {} + + ~ReadBasicInformationManufacturingDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeManufacturingDateWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ManufacturingDate response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation ManufacturingDate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationManufacturingDate + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationManufacturingDate() + : SubscribeAttribute("manufacturing-date") {} + + ~SubscribeAttributeBasicInformationManufacturingDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeManufacturingDateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ManufacturingDate response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute PartNumber */ -class ReadAccessControlClusterRevision : public ReadAttribute { +class ReadBasicInformationPartNumber : public ReadAttribute { public: - ReadAccessControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadBasicInformationPartNumber() : ReadAttribute("part-number") {} + + ~ReadBasicInformationPartNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePartNumberWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.PartNumber response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation PartNumber read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadAccessControlClusterRevision() {} +class SubscribeAttributeBasicInformationPartNumber : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationPartNumber() + : SubscribeAttribute("part-number") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeBasicInformationPartNumber() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("AccessControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePartNumberWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.PartNumber response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAccessControlClusterRevision : public SubscribeAttribute { +/* + * Attribute ProductURL + */ +class ReadBasicInformationProductURL : public ReadAttribute { public: - SubscribeAttributeAccessControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadBasicInformationProductURL() : ReadAttribute("product-url") {} + + ~ReadBasicInformationProductURL() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductURLWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductURL response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation ProductURL read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeAccessControlClusterRevision() {} +class SubscribeAttributeBasicInformationProductURL : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationProductURL() + : SubscribeAttribute("product-url") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000001F) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccessControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeBasicInformationProductURL() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductURLWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductURL response %@", + [value description]); + SetCommandExitStatus(error); + }]; -/*----------------------------------------------------------------------------*\ -| Cluster Actions | 0x0025 | -|------------------------------------------------------------------------------| -| Commands: | | -| * InstantAction | 0x00 | -| * InstantActionWithTransition | 0x01 | -| * StartAction | 0x02 | -| * StartActionWithDuration | 0x03 | -| * StopAction | 0x04 | -| * PauseAction | 0x05 | -| * PauseActionWithDuration | 0x06 | -| * ResumeAction | 0x07 | -| * EnableAction | 0x08 | -| * EnableActionWithDuration | 0x09 | -| * DisableAction | 0x0A | -| * DisableActionWithDuration | 0x0B | -|------------------------------------------------------------------------------| -| Attributes: | | -| * ActionList | 0x0000 | -| * EndpointLists | 0x0001 | -| * SetupURL | 0x0002 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * StateChanged | 0x0000 | -| * ActionFailed | 0x0001 | -\*----------------------------------------------------------------------------*/ + return CHIP_NO_ERROR; + } +}; /* - * Command InstantAction + * Attribute ProductLabel */ -class ActionsInstantAction : public ClusterCommand { +class ReadBasicInformationProductLabel : public ReadAttribute { public: - ActionsInstantAction() - : ClusterCommand("instant-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterInstantActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster instantActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::InstantAction::Type mRequest; + ReadBasicInformationProductLabel() : ReadAttribute("product-label") {} + + ~ReadBasicInformationProductLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductLabelWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductLabel response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation ProductLabel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationProductLabel + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationProductLabel() + : SubscribeAttribute("product-label") {} + + ~SubscribeAttributeBasicInformationProductLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductLabelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ProductLabel response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command InstantActionWithTransition + * Attribute SerialNumber */ -class ActionsInstantActionWithTransition : public ClusterCommand { +class ReadBasicInformationSerialNumber : public ReadAttribute { public: - ActionsInstantActionWithTransition() - : ClusterCommand("instant-action-with-transition") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterInstantActionWithTransitionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster instantActionWithTransitionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Type mRequest; + ReadBasicInformationSerialNumber() : ReadAttribute("serial-number") {} + + ~ReadBasicInformationSerialNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSerialNumberWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SerialNumber response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation SerialNumber read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationSerialNumber + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationSerialNumber() + : SubscribeAttribute("serial-number") {} + + ~SubscribeAttributeBasicInformationSerialNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSerialNumberWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.SerialNumber response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command StartAction + * Attribute LocalConfigDisabled */ -class ActionsStartAction : public ClusterCommand { +class ReadBasicInformationLocalConfigDisabled : public ReadAttribute { public: - ActionsStartAction() - : ClusterCommand("start-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterStartActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster startActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + ReadBasicInformationLocalConfigDisabled() + : ReadAttribute("local-config-disabled") {} + + ~ReadBasicInformationLocalConfigDisabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocalConfigDisabledWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.LocalConfigDisabled response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation LocalConfigDisabled read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteBasicInformationLocalConfigDisabled : public WriteAttribute { +public: + WriteBasicInformationLocalConfigDisabled() + : WriteAttribute("local-config-disabled") { + AddArgument("attr-name", "local-config-disabled"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBasicInformationLocalConfigDisabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeLocalConfigDisabledWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BasicInformation " + "LocalConfigDisabled " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::Actions::Commands::StartAction::Type mRequest; + bool mValue; }; -/* - * Command StartActionWithDuration - */ -class ActionsStartActionWithDuration : public ClusterCommand { +class SubscribeAttributeBasicInformationLocalConfigDisabled + : public SubscribeAttribute { public: - ActionsStartActionWithDuration() - : ClusterCommand("start-action-with-duration") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterStartActionWithDurationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster startActionWithDurationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBasicInformationLocalConfigDisabled() + : SubscribeAttribute("local-config-disabled") {} + + ~SubscribeAttributeBasicInformationLocalConfigDisabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocalConfigDisabledWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.LocalConfigDisabled response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::Actions::Commands::StartActionWithDuration::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command StopAction + * Attribute Reachable */ -class ActionsStopAction : public ClusterCommand { +class ReadBasicInformationReachable : public ReadAttribute { public: - ActionsStopAction() - : ClusterCommand("stop-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterStopActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::StopAction::Type mRequest; + ReadBasicInformationReachable() : ReadAttribute("reachable") {} + + ~ReadBasicInformationReachable() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReachableWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.Reachable response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation Reachable read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command PauseAction - */ -class ActionsPauseAction : public ClusterCommand { +class SubscribeAttributeBasicInformationReachable : public SubscribeAttribute { public: - ActionsPauseAction() - : ClusterCommand("pause-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterPauseActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster pauseActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBasicInformationReachable() + : SubscribeAttribute("reachable") {} + + ~SubscribeAttributeBasicInformationReachable() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeReachableWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.Reachable response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::Actions::Commands::PauseAction::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command PauseActionWithDuration + * Attribute UniqueID */ -class ActionsPauseActionWithDuration : public ClusterCommand { +class ReadBasicInformationUniqueID : public ReadAttribute { public: - ActionsPauseActionWithDuration() - : ClusterCommand("pause-action-with-duration") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterPauseActionWithDurationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster pauseActionWithDurationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Type mRequest; + ReadBasicInformationUniqueID() : ReadAttribute("unique-id") {} + + ~ReadBasicInformationUniqueID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUniqueIDWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.UniqueID response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation UniqueID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command ResumeAction - */ -class ActionsResumeAction : public ClusterCommand { +class SubscribeAttributeBasicInformationUniqueID : public SubscribeAttribute { public: - ActionsResumeAction() - : ClusterCommand("resume-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterResumeActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster resumeActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBasicInformationUniqueID() + : SubscribeAttribute("unique-id") {} + + ~SubscribeAttributeBasicInformationUniqueID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUniqueIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.UniqueID response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::Actions::Commands::ResumeAction::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command EnableAction + * Attribute CapabilityMinima */ -class ActionsEnableAction : public ClusterCommand { +class ReadBasicInformationCapabilityMinima : public ReadAttribute { public: - ActionsEnableAction() - : ClusterCommand("enable-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterEnableActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enableActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::EnableAction::Type mRequest; + ReadBasicInformationCapabilityMinima() : ReadAttribute("capability-minima") {} + + ~ReadBasicInformationCapabilityMinima() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeCapabilityMinimaWithCompletion:^( + MTRBasicInformationClusterCapabilityMinimaStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.CapabilityMinima response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation CapabilityMinima read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationCapabilityMinima + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationCapabilityMinima() + : SubscribeAttribute("capability-minima") {} + + ~SubscribeAttributeBasicInformationCapabilityMinima() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCapabilityMinimaWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^( + MTRBasicInformationClusterCapabilityMinimaStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.CapabilityMinima response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command EnableActionWithDuration + * Attribute GeneratedCommandList */ -class ActionsEnableActionWithDuration : public ClusterCommand { +class ReadBasicInformationGeneratedCommandList : public ReadAttribute { public: - ActionsEnableActionWithDuration() - : ClusterCommand("enable-action-with-duration") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterEnableActionWithDurationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enableActionWithDurationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Type mRequest; + ReadBasicInformationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBasicInformationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBasicInformationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command DisableAction + * Attribute AcceptedCommandList */ -class ActionsDisableAction : public ClusterCommand { +class ReadBasicInformationAcceptedCommandList : public ReadAttribute { public: - ActionsDisableAction() - : ClusterCommand("disable-action") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterDisableActionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster disableActionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::DisableAction::Type mRequest; + ReadBasicInformationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBasicInformationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBasicInformationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command DisableActionWithDuration + * Attribute AttributeList */ -class ActionsDisableActionWithDuration : public ClusterCommand { +class ReadBasicInformationAttributeList : public ReadAttribute { public: - ActionsDisableActionWithDuration() - : ClusterCommand("disable-action-with-duration") - { - AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); - AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); - AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) command (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRActionsClusterDisableActionWithDurationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; - if (mRequest.invokeID.HasValue()) { - params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; - } else { - params.invokeID = nil; - } - params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster disableActionWithDurationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Type mRequest; + ReadBasicInformationAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBasicInformationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeBasicInformationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActionList + * Attribute FeatureMap */ -class ReadActionsActionList : public ReadAttribute { +class ReadBasicInformationFeatureMap : public ReadAttribute { public: - ReadActionsActionList() - : ReadAttribute("action-list") - { - } - - ~ReadActionsActionList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeActionListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.ActionList response %@", [value description]); - if (error != nil) { - LogNSError("Actions ActionList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBasicInformationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBasicInformationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BasicInformation.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("BasicInformation FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeActionsActionList : public SubscribeAttribute { +class SubscribeAttributeBasicInformationFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeActionsActionList() - : SubscribeAttribute("action-list") - { - } + SubscribeAttributeBasicInformationFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeActionsActionList() {} + ~SubscribeAttributeBasicInformationFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActionListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.ActionList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute EndpointLists + * Attribute ClusterRevision */ -class ReadActionsEndpointLists : public ReadAttribute { +class ReadBasicInformationClusterRevision : public ReadAttribute { public: - ReadActionsEndpointLists() - : ReadAttribute("endpoint-lists") - { - } + ReadBasicInformationClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBasicInformationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("BasicInformation ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBasicInformationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBasicInformationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBasicInformationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000028) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBasicInformation alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BasicInformation.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadActionsEndpointLists() {} +/*----------------------------------------------------------------------------*\ +| Cluster OtaSoftwareUpdateProvider | 0x0029 | +|------------------------------------------------------------------------------| +| Commands: | | +| * QueryImage | 0x00 | +| * ApplyUpdateRequest | 0x02 | +| * NotifyUpdateApplied | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x00000001) on endpoint %u", endpointId); +/* + * Command QueryImage + */ +class OtaSoftwareUpdateProviderQueryImage : public ClusterCommand { +public: + OtaSoftwareUpdateProviderQueryImage() + : ClusterCommand("query-image"), + mComplex_ProtocolsSupported(&mRequest.protocolsSupported) { + AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); + AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); + AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); + AddArgument("ProtocolsSupported", &mComplex_ProtocolsSupported); + AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); + AddArgument("Location", &mRequest.location); + AddArgument("RequestorCanConsent", 0, 1, &mRequest.requestorCanConsent); + AddArgument("MetadataForProvider", &mRequest.metadataForProvider); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000029) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROTASoftwareUpdateProviderClusterQueryImageParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.vendorId = [NSNumber + numberWithUnsignedShort:chip::to_underlying(mRequest.vendorId)]; + params.productId = [NSNumber numberWithUnsignedShort:mRequest.productId]; + params.softwareVersion = + [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.protocolsSupported) { + NSNumber *newElement_0; + newElement_0 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + params.protocolsSupported = array_0; + } + if (mRequest.hardwareVersion.HasValue()) { + params.hardwareVersion = + [NSNumber numberWithUnsignedShort:mRequest.hardwareVersion.Value()]; + } else { + params.hardwareVersion = nil; + } + if (mRequest.location.HasValue()) { + params.location = + [[NSString alloc] initWithBytes:mRequest.location.Value().data() + length:mRequest.location.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + params.location = nil; + } + if (mRequest.requestorCanConsent.HasValue()) { + params.requestorCanConsent = + [NSNumber numberWithBool:mRequest.requestorCanConsent.Value()]; + } else { + params.requestorCanConsent = nil; + } + if (mRequest.metadataForProvider.HasValue()) { + params.metadataForProvider = + [NSData dataWithBytes:mRequest.metadataForProvider.Value().data() + length:mRequest.metadataForProvider.Value().size()]; + } else { + params.metadataForProvider = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + queryImageWithParams:params + completion:^( + MTROTASoftwareUpdateProviderClusterQueryImageResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeEndpointListsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.EndpointLists response %@", [value description]); - if (error != nil) { - LogNSError("Actions EndpointLists read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type + mRequest; + TypedComplexArgument> + mComplex_ProtocolsSupported; }; -class SubscribeAttributeActionsEndpointLists : public SubscribeAttribute { +/* + * Command ApplyUpdateRequest + */ +class OtaSoftwareUpdateProviderApplyUpdateRequest : public ClusterCommand { public: - SubscribeAttributeActionsEndpointLists() - : SubscribeAttribute("endpoint-lists") - { + OtaSoftwareUpdateProviderApplyUpdateRequest() + : ClusterCommand("apply-update-request") { + AddArgument("UpdateToken", &mRequest.updateToken); + AddArgument("NewVersion", 0, UINT32_MAX, &mRequest.newVersion); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000029) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() + length:mRequest.updateToken.size()]; + params.newVersion = [NSNumber numberWithUnsignedInt:mRequest.newVersion]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + applyUpdateRequestWithParams:params + completion:^( + MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeActionsEndpointLists() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEndpointListsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.EndpointLists response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest:: + Type mRequest; }; /* - * Attribute SetupURL + * Command NotifyUpdateApplied */ -class ReadActionsSetupURL : public ReadAttribute { +class OtaSoftwareUpdateProviderNotifyUpdateApplied : public ClusterCommand { public: - ReadActionsSetupURL() - : ReadAttribute("setup-url") - { + OtaSoftwareUpdateProviderNotifyUpdateApplied() + : ClusterCommand("notify-update-applied") { + AddArgument("UpdateToken", &mRequest.updateToken); + AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000029) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() + length:mRequest.updateToken.size()]; + params.softwareVersion = + [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster notifyUpdateAppliedWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadActionsSetupURL() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSetupURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.SetupURL response %@", [value description]); - if (error != nil) { - LogNSError("Actions SetupURL read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands:: + NotifyUpdateApplied::Type mRequest; }; -class SubscribeAttributeActionsSetupURL : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadOtaSoftwareUpdateProviderGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeActionsSetupURL() - : SubscribeAttribute("setup-url") - { - } - - ~SubscribeAttributeActionsSetupURL() {} + ReadOtaSoftwareUpdateProviderGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadOtaSoftwareUpdateProviderGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateProvider GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSetupURLWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.SetupURL response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadOtaSoftwareUpdateProviderAcceptedCommandList : public ReadAttribute { +public: + ReadOtaSoftwareUpdateProviderAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadOtaSoftwareUpdateProviderAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateProvider AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute AttributeList */ -class ReadActionsGeneratedCommandList : public ReadAttribute { +class ReadOtaSoftwareUpdateProviderAttributeList : public ReadAttribute { public: - ReadActionsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadActionsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Actions GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOtaSoftwareUpdateProviderAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadOtaSoftwareUpdateProviderAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateProvider AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateProviderAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeActionsGeneratedCommandList : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadOtaSoftwareUpdateProviderFeatureMap : public ReadAttribute { public: - SubscribeAttributeActionsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeActionsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOtaSoftwareUpdateProviderFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOtaSoftwareUpdateProviderFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateProvider FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute ClusterRevision */ -class ReadActionsAcceptedCommandList : public ReadAttribute { +class ReadOtaSoftwareUpdateProviderClusterRevision : public ReadAttribute { public: - ReadActionsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadActionsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Actions AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOtaSoftwareUpdateProviderClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadOtaSoftwareUpdateProviderClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateProvider ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000029) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeActionsAcceptedCommandList : public SubscribeAttribute { +/*----------------------------------------------------------------------------*\ +| Cluster OtaSoftwareUpdateRequestor | 0x002A | +|------------------------------------------------------------------------------| +| Commands: | | +| * AnnounceOtaProvider | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DefaultOtaProviders | 0x0000 | +| * UpdatePossible | 0x0001 | +| * UpdateState | 0x0002 | +| * UpdateStateProgress | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * StateTransition | 0x0000 | +| * VersionApplied | 0x0001 | +| * DownloadError | 0x0002 | +\*----------------------------------------------------------------------------*/ + +/* + * Command AnnounceOtaProvider + */ +class OtaSoftwareUpdateRequestorAnnounceOtaProvider : public ClusterCommand { public: - SubscribeAttributeActionsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { + OtaSoftwareUpdateRequestorAnnounceOtaProvider() + : ClusterCommand("announce-ota-provider") { + AddArgument("ProviderNodeId", 0, UINT64_MAX, &mRequest.providerNodeId); + AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); + AddArgument("AnnouncementReason", 0, UINT8_MAX, + &mRequest.announcementReason); + AddArgument("MetadataForNode", &mRequest.metadataForNode); + AddArgument("Endpoint", 0, UINT16_MAX, &mRequest.endpoint); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000002A) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROTASoftwareUpdateRequestorClusterAnnounceOtaProviderParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.providerNodeId = + [NSNumber numberWithUnsignedLongLong:mRequest.providerNodeId]; + params.vendorId = [NSNumber + numberWithUnsignedShort:chip::to_underlying(mRequest.vendorId)]; + params.announcementReason = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.announcementReason)]; + if (mRequest.metadataForNode.HasValue()) { + params.metadataForNode = + [NSData dataWithBytes:mRequest.metadataForNode.Value().data() + length:mRequest.metadataForNode.Value().size()]; + } else { + params.metadataForNode = nil; + } + params.endpoint = [NSNumber numberWithUnsignedShort:mRequest.endpoint]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster announceOtaProviderWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeActionsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands:: + AnnounceOtaProvider::Type mRequest; }; /* - * Attribute AttributeList + * Attribute DefaultOtaProviders */ -class ReadActionsAttributeList : public ReadAttribute { +class ReadOtaSoftwareUpdateRequestorDefaultOtaProviders : public ReadAttribute { public: - ReadActionsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadActionsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); + ReadOtaSoftwareUpdateRequestorDefaultOtaProviders() + : ReadAttribute("default-ota-providers") {} + + ~ReadOtaSoftwareUpdateRequestorDefaultOtaProviders() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeDefaultOtaProvidersWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor." + @"DefaultOtaProviders response " + @"%@", + [value description]); + if (error != nil) { + LogNSError( + "OTASoftwareUpdateRequestor " + "DefaultOtaProviders read " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOtaSoftwareUpdateRequestorDefaultOtaProviders + : public WriteAttribute { +public: + WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() + : WriteAttribute("default-ota-providers"), mComplex(&mValue) { + AddArgument("attr-name", "default-ota-providers"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTROTASoftwareUpdateRequestorClusterProviderLocation *newElement_0; + newElement_0 = + [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; + newElement_0.providerNodeID = + [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; + newElement_0.endpoint = + [NSNumber numberWithUnsignedShort:entry_0.endpoint]; + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeDefaultOtaProvidersWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "OTASoftwareUpdateRequestor " + "DefaultOtaProviders write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Actions AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::DataModel::List< + const chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs:: + ProviderLocation::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeActionsAttributeList : public SubscribeAttribute { +class SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders + : public SubscribeAttribute { public: - SubscribeAttributeActionsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders() + : SubscribeAttribute("default-ota-providers") {} - ~SubscribeAttributeActionsAttributeList() {} + ~SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDefaultOtaProvidersWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.DefaultOtaProviders response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute UpdatePossible */ -class ReadActionsFeatureMap : public ReadAttribute { +class ReadOtaSoftwareUpdateRequestorUpdatePossible : public ReadAttribute { public: - ReadActionsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadActionsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Actions FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOtaSoftwareUpdateRequestorUpdatePossible() + : ReadAttribute("update-possible") {} + + ~ReadOtaSoftwareUpdateRequestorUpdatePossible() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUpdatePossibleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor UpdatePossible read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() + : SubscribeAttribute("update-possible") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUpdatePossibleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeActionsFeatureMap : public SubscribeAttribute { +/* + * Attribute UpdateState + */ +class ReadOtaSoftwareUpdateRequestorUpdateState : public ReadAttribute { public: - SubscribeAttributeActionsFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeActionsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOtaSoftwareUpdateRequestorUpdateState() : ReadAttribute("update-state") {} + + ~ReadOtaSoftwareUpdateRequestorUpdateState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUpdateStateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor UpdateState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() + : SubscribeAttribute("update-state") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUpdateStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute UpdateStateProgress */ -class ReadActionsClusterRevision : public ReadAttribute { +class ReadOtaSoftwareUpdateRequestorUpdateStateProgress : public ReadAttribute { public: - ReadActionsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadActionsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ReadOtaSoftwareUpdateRequestorUpdateStateProgress() + : ReadAttribute("update-state-progress") {} + + ~ReadOtaSoftwareUpdateRequestorUpdateStateProgress() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUpdateStateProgressWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor UpdateStateProgress read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() + : SubscribeAttribute("update-state-progress") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUpdateStateProgressWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Actions ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadOtaSoftwareUpdateRequestorGeneratedCommandList + : public ReadAttribute { +public: + ReadOtaSoftwareUpdateRequestorGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadOtaSoftwareUpdateRequestorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeActionsClusterRevision : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadOtaSoftwareUpdateRequestorAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeActionsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadOtaSoftwareUpdateRequestorAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadOtaSoftwareUpdateRequestorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeActionsClusterRevision() {} +/* + * Attribute AttributeList + */ +class ReadOtaSoftwareUpdateRequestorAttributeList : public ReadAttribute { +public: + ReadOtaSoftwareUpdateRequestorAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadOtaSoftwareUpdateRequestorAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000025) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Actions.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute FeatureMap + */ +class ReadOtaSoftwareUpdateRequestorFeatureMap : public ReadAttribute { +public: + ReadOtaSoftwareUpdateRequestorFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOtaSoftwareUpdateRequestorFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadOtaSoftwareUpdateRequestorClusterRevision : public ReadAttribute { +public: + ReadOtaSoftwareUpdateRequestorClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadOtaSoftwareUpdateRequestorClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("OTASoftwareUpdateRequestor ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster BasicInformation | 0x0028 | +| Cluster LocalizationConfiguration | 0x002B | |------------------------------------------------------------------------------| | Commands: | | -| * MfgSpecificPing | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * DataModelRevision | 0x0000 | -| * VendorName | 0x0001 | -| * VendorID | 0x0002 | -| * ProductName | 0x0003 | -| * ProductID | 0x0004 | -| * NodeLabel | 0x0005 | -| * Location | 0x0006 | -| * HardwareVersion | 0x0007 | -| * HardwareVersionString | 0x0008 | -| * SoftwareVersion | 0x0009 | -| * SoftwareVersionString | 0x000A | -| * ManufacturingDate | 0x000B | -| * PartNumber | 0x000C | -| * ProductURL | 0x000D | -| * ProductLabel | 0x000E | -| * SerialNumber | 0x000F | -| * LocalConfigDisabled | 0x0010 | -| * Reachable | 0x0011 | -| * UniqueID | 0x0012 | -| * CapabilityMinima | 0x0013 | +| * ActiveLocale | 0x0000 | +| * SupportedLocales | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -10958,2456 +16647,5426 @@ class SubscribeAttributeActionsClusterRevision : public SubscribeAttribute { | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * StartUp | 0x0000 | -| * ShutDown | 0x0001 | -| * Leave | 0x0002 | -| * ReachableChanged | 0x0003 | \*----------------------------------------------------------------------------*/ /* - * Attribute DataModelRevision + * Attribute ActiveLocale */ -class ReadBasicInformationDataModelRevision : public ReadAttribute { +class ReadLocalizationConfigurationActiveLocale : public ReadAttribute { public: - ReadBasicInformationDataModelRevision() - : ReadAttribute("data-model-revision") - { - } - - ~ReadBasicInformationDataModelRevision() {} + ReadLocalizationConfigurationActiveLocale() + : ReadAttribute("active-locale") {} + + ~ReadLocalizationConfigurationActiveLocale() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveLocaleWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.ActiveLocale response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration ActiveLocale read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000000) on endpoint %u", endpointId); +class WriteLocalizationConfigurationActiveLocale : public WriteAttribute { +public: + WriteLocalizationConfigurationActiveLocale() + : WriteAttribute("active-locale") { + AddArgument("attr-name", "active-locale"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteLocalizationConfigurationActiveLocale() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeActiveLocaleWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("LocalizationConfiguration " + "ActiveLocale write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDataModelRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.DataModelRevision response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation DataModelRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeBasicInformationDataModelRevision : public SubscribeAttribute { +class SubscribeAttributeLocalizationConfigurationActiveLocale + : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationDataModelRevision() - : SubscribeAttribute("data-model-revision") - { - } + SubscribeAttributeLocalizationConfigurationActiveLocale() + : SubscribeAttribute("active-locale") {} - ~SubscribeAttributeBasicInformationDataModelRevision() {} + ~SubscribeAttributeLocalizationConfigurationActiveLocale() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveLocaleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDataModelRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.DataModelRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.ActiveLocale response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute VendorName + * Attribute SupportedLocales */ -class ReadBasicInformationVendorName : public ReadAttribute { +class ReadLocalizationConfigurationSupportedLocales : public ReadAttribute { public: - ReadBasicInformationVendorName() - : ReadAttribute("vendor-name") - { - } + ReadLocalizationConfigurationSupportedLocales() + : ReadAttribute("supported-locales") {} + + ~ReadLocalizationConfigurationSupportedLocales() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedLocalesWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.SupportedLocales response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration SupportedLocales read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationSupportedLocales + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationSupportedLocales() + : SubscribeAttribute("supported-locales") {} + + ~SubscribeAttributeLocalizationConfigurationSupportedLocales() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedLocalesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.SupportedLocales response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadBasicInformationVendorName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.VendorName response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation VendorName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBasicInformationVendorName : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadLocalizationConfigurationGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeBasicInformationVendorName() - : SubscribeAttribute("vendor-name") - { - } - - ~SubscribeAttributeBasicInformationVendorName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVendorNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.VendorName response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLocalizationConfigurationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadLocalizationConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeLocalizationConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute VendorID + * Attribute AcceptedCommandList */ -class ReadBasicInformationVendorID : public ReadAttribute { +class ReadLocalizationConfigurationAcceptedCommandList : public ReadAttribute { public: - ReadBasicInformationVendorID() - : ReadAttribute("vendor-id") - { - } - - ~ReadBasicInformationVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.VendorID response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation VendorID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLocalizationConfigurationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadLocalizationConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeLocalizationConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationVendorID : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadLocalizationConfigurationAttributeList : public ReadAttribute { public: - SubscribeAttributeBasicInformationVendorID() - : SubscribeAttribute("vendor-id") - { - } - - ~SubscribeAttributeBasicInformationVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVendorIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.VendorID response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLocalizationConfigurationAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadLocalizationConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeLocalizationConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductName + * Attribute FeatureMap */ -class ReadBasicInformationProductName : public ReadAttribute { +class ReadLocalizationConfigurationFeatureMap : public ReadAttribute { public: - ReadBasicInformationProductName() - : ReadAttribute("product-name") - { - } - - ~ReadBasicInformationProductName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductName response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ProductName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLocalizationConfigurationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadLocalizationConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeLocalizationConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationProductName : public SubscribeAttribute { +/* + * Attribute ClusterRevision + */ +class ReadLocalizationConfigurationClusterRevision : public ReadAttribute { public: - SubscribeAttributeBasicInformationProductName() - : SubscribeAttribute("product-name") - { - } - - ~SubscribeAttributeBasicInformationProductName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeProductNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductName response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLocalizationConfigurationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadLocalizationConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("LocalizationConfiguration ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLocalizationConfigurationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeLocalizationConfigurationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeLocalizationConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterLocalizationConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LocalizationConfiguration.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster TimeFormatLocalization | 0x002C | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * HourFormat | 0x0000 | +| * ActiveCalendarType | 0x0001 | +| * SupportedCalendarTypes | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute ProductID + * Attribute HourFormat */ -class ReadBasicInformationProductID : public ReadAttribute { +class ReadTimeFormatLocalizationHourFormat : public ReadAttribute { public: - ReadBasicInformationProductID() - : ReadAttribute("product-id") - { - } - - ~ReadBasicInformationProductID() {} + ReadTimeFormatLocalizationHourFormat() : ReadAttribute("hour-format") {} + + ~ReadTimeFormatLocalizationHourFormat() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHourFormatWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.HourFormat response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization HourFormat read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000004) on endpoint %u", endpointId); +class WriteTimeFormatLocalizationHourFormat : public WriteAttribute { +public: + WriteTimeFormatLocalizationHourFormat() : WriteAttribute("hour-format") { + AddArgument("attr-name", "hour-format"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteTimeFormatLocalizationHourFormat() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeHourFormatWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("TimeFormatLocalization " + "HourFormat write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductID response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ProductID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBasicInformationProductID : public SubscribeAttribute { +class SubscribeAttributeTimeFormatLocalizationHourFormat + : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationProductID() - : SubscribeAttribute("product-id") - { - } + SubscribeAttributeTimeFormatLocalizationHourFormat() + : SubscribeAttribute("hour-format") {} - ~SubscribeAttributeBasicInformationProductID() {} + ~SubscribeAttributeTimeFormatLocalizationHourFormat() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHourFormatWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeProductIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductID response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.HourFormat response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute NodeLabel + * Attribute ActiveCalendarType */ -class ReadBasicInformationNodeLabel : public ReadAttribute { +class ReadTimeFormatLocalizationActiveCalendarType : public ReadAttribute { public: - ReadBasicInformationNodeLabel() - : ReadAttribute("node-label") - { - } - - ~ReadBasicInformationNodeLabel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNodeLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.NodeLabel response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation NodeLabel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadTimeFormatLocalizationActiveCalendarType() + : ReadAttribute("active-calendar-type") {} + + ~ReadTimeFormatLocalizationActiveCalendarType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveCalendarTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization ActiveCalendarType read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteBasicInformationNodeLabel : public WriteAttribute { +class WriteTimeFormatLocalizationActiveCalendarType : public WriteAttribute { public: - WriteBasicInformationNodeLabel() - : WriteAttribute("node-label") - { - AddArgument("attr-name", "node-label"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBasicInformationNodeLabel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeNodeLabelWithValue:value + WriteTimeFormatLocalizationActiveCalendarType() + : WriteAttribute("active-calendar-type") { + AddArgument("attr-name", "active-calendar-type"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteTimeFormatLocalizationActiveCalendarType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeActiveCalendarTypeWithValue:value params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BasicInformation NodeLabel write Error", error); - } - SetCommandExitStatus(error); + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "TimeFormatLocalization " + "ActiveCalendarType write Error", + error); + } + SetCommandExitStatus(error); }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + uint8_t mValue; }; -class SubscribeAttributeBasicInformationNodeLabel : public SubscribeAttribute { +class SubscribeAttributeTimeFormatLocalizationActiveCalendarType + : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationNodeLabel() - : SubscribeAttribute("node-label") - { - } + SubscribeAttributeTimeFormatLocalizationActiveCalendarType() + : SubscribeAttribute("active-calendar-type") {} - ~SubscribeAttributeBasicInformationNodeLabel() {} + ~SubscribeAttributeTimeFormatLocalizationActiveCalendarType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveCalendarTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNodeLabelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.NodeLabel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Location + * Attribute SupportedCalendarTypes */ -class ReadBasicInformationLocation : public ReadAttribute { +class ReadTimeFormatLocalizationSupportedCalendarTypes : public ReadAttribute { public: - ReadBasicInformationLocation() - : ReadAttribute("location") - { - } - - ~ReadBasicInformationLocation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLocationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.Location response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation Location read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadTimeFormatLocalizationSupportedCalendarTypes() + : ReadAttribute("supported-calendar-types") {} + + ~ReadTimeFormatLocalizationSupportedCalendarTypes() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedCalendarTypesWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization SupportedCalendarTypes read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() + : SubscribeAttribute("supported-calendar-types") {} + + ~SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedCalendarTypesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteBasicInformationLocation : public WriteAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadTimeFormatLocalizationGeneratedCommandList : public ReadAttribute { public: - WriteBasicInformationLocation() - : WriteAttribute("location") - { - AddArgument("attr-name", "location"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBasicInformationLocation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) WriteAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeLocationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BasicInformation Location write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::ByteSpan mValue; + ReadTimeFormatLocalizationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadTimeFormatLocalizationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationLocation : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadTimeFormatLocalizationAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeBasicInformationLocation() - : SubscribeAttribute("location") - { - } - - ~SubscribeAttributeBasicInformationLocation() {} + ReadTimeFormatLocalizationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadTimeFormatLocalizationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.Location response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute AttributeList + */ +class ReadTimeFormatLocalizationAttributeList : public ReadAttribute { +public: + ReadTimeFormatLocalizationAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadTimeFormatLocalizationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeTimeFormatLocalizationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadTimeFormatLocalizationFeatureMap : public ReadAttribute { +public: + ReadTimeFormatLocalizationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadTimeFormatLocalizationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeTimeFormatLocalizationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute HardwareVersion + * Attribute ClusterRevision */ -class ReadBasicInformationHardwareVersion : public ReadAttribute { +class ReadTimeFormatLocalizationClusterRevision : public ReadAttribute { public: - ReadBasicInformationHardwareVersion() - : ReadAttribute("hardware-version") - { - } + ReadTimeFormatLocalizationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadTimeFormatLocalizationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("TimeFormatLocalization ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTimeFormatLocalizationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeTimeFormatLocalizationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeTimeFormatLocalizationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTimeFormatLocalization alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TimeFormatLocalization.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/*----------------------------------------------------------------------------*\ +| Cluster UnitLocalization | 0x002D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * TemperatureUnit | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - ~ReadBasicInformationHardwareVersion() {} +/* + * Attribute TemperatureUnit + */ +class ReadUnitLocalizationTemperatureUnit : public ReadAttribute { +public: + ReadUnitLocalizationTemperatureUnit() : ReadAttribute("temperature-unit") {} + + ~ReadUnitLocalizationTemperatureUnit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTemperatureUnitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.TemperatureUnit response %@", + [value description]); + if (error != nil) { + LogNSError("UnitLocalization TemperatureUnit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000007) on endpoint %u", endpointId); +class WriteUnitLocalizationTemperatureUnit : public WriteAttribute { +public: + WriteUnitLocalizationTemperatureUnit() : WriteAttribute("temperature-unit") { + AddArgument("attr-name", "temperature-unit"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitLocalizationTemperatureUnit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeTemperatureUnitWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitLocalization TemperatureUnit " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHardwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.HardwareVersion response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation HardwareVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBasicInformationHardwareVersion : public SubscribeAttribute { +class SubscribeAttributeUnitLocalizationTemperatureUnit + : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationHardwareVersion() - : SubscribeAttribute("hardware-version") - { - } + SubscribeAttributeUnitLocalizationTemperatureUnit() + : SubscribeAttribute("temperature-unit") {} - ~SubscribeAttributeBasicInformationHardwareVersion() {} + ~SubscribeAttributeUnitLocalizationTemperatureUnit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTemperatureUnitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeHardwareVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.HardwareVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.TemperatureUnit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute HardwareVersionString + * Attribute GeneratedCommandList */ -class ReadBasicInformationHardwareVersionString : public ReadAttribute { +class ReadUnitLocalizationGeneratedCommandList : public ReadAttribute { public: - ReadBasicInformationHardwareVersionString() - : ReadAttribute("hardware-version-string") - { - } - - ~ReadBasicInformationHardwareVersionString() {} + ReadUnitLocalizationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadUnitLocalizationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("UnitLocalization GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitLocalizationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUnitLocalizationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeUnitLocalizationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHardwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.HardwareVersionString response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation HardwareVersionString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadUnitLocalizationAcceptedCommandList : public ReadAttribute { +public: + ReadUnitLocalizationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadUnitLocalizationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("UnitLocalization AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitLocalizationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUnitLocalizationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeUnitLocalizationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationHardwareVersionString : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadUnitLocalizationAttributeList : public ReadAttribute { public: - SubscribeAttributeBasicInformationHardwareVersionString() - : SubscribeAttribute("hardware-version-string") - { - } - - ~SubscribeAttributeBasicInformationHardwareVersionString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeHardwareVersionStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.HardwareVersionString response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadUnitLocalizationAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadUnitLocalizationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("UnitLocalization AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitLocalizationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeUnitLocalizationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeUnitLocalizationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SoftwareVersion + * Attribute FeatureMap */ -class ReadBasicInformationSoftwareVersion : public ReadAttribute { +class ReadUnitLocalizationFeatureMap : public ReadAttribute { public: - ReadBasicInformationSoftwareVersion() - : ReadAttribute("software-version") - { - } - - ~ReadBasicInformationSoftwareVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSoftwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SoftwareVersion response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation SoftwareVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitLocalizationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadUnitLocalizationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("UnitLocalization FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationSoftwareVersion : public SubscribeAttribute { +class SubscribeAttributeUnitLocalizationFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationSoftwareVersion() - : SubscribeAttribute("software-version") - { - } + SubscribeAttributeUnitLocalizationFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeBasicInformationSoftwareVersion() {} + ~SubscribeAttributeUnitLocalizationFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSoftwareVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SoftwareVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SoftwareVersionString + * Attribute ClusterRevision */ -class ReadBasicInformationSoftwareVersionString : public ReadAttribute { +class ReadUnitLocalizationClusterRevision : public ReadAttribute { public: - ReadBasicInformationSoftwareVersionString() - : ReadAttribute("software-version-string") - { - } - - ~ReadBasicInformationSoftwareVersionString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSoftwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SoftwareVersionString response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation SoftwareVersionString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitLocalizationClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadUnitLocalizationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("UnitLocalization ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitLocalizationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeUnitLocalizationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeUnitLocalizationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitLocalization.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationSoftwareVersionString : public SubscribeAttribute { -public: - SubscribeAttributeBasicInformationSoftwareVersionString() - : SubscribeAttribute("software-version-string") - { - } - - ~SubscribeAttributeBasicInformationSoftwareVersionString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSoftwareVersionStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SoftwareVersionString response %@", [value description]); - SetCommandExitStatus(error); - }]; +/*----------------------------------------------------------------------------*\ +| Cluster PowerSourceConfiguration | 0x002E | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Sources | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - return CHIP_NO_ERROR; - } +/* + * Attribute Sources + */ +class ReadPowerSourceConfigurationSources : public ReadAttribute { +public: + ReadPowerSourceConfigurationSources() : ReadAttribute("sources") {} + + ~ReadPowerSourceConfigurationSources() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSourcesWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.Sources response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration Sources read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationSources + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationSources() + : SubscribeAttribute("sources") {} + + ~SubscribeAttributePowerSourceConfigurationSources() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSourcesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.Sources response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ManufacturingDate + * Attribute GeneratedCommandList */ -class ReadBasicInformationManufacturingDate : public ReadAttribute { +class ReadPowerSourceConfigurationGeneratedCommandList : public ReadAttribute { public: - ReadBasicInformationManufacturingDate() - : ReadAttribute("manufacturing-date") - { - } - - ~ReadBasicInformationManufacturingDate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeManufacturingDateWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ManufacturingDate response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ManufacturingDate read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceConfigurationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadPowerSourceConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributePowerSourceConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationManufacturingDate : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadPowerSourceConfigurationAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeBasicInformationManufacturingDate() - : SubscribeAttribute("manufacturing-date") - { - } - - ~SubscribeAttributeBasicInformationManufacturingDate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeManufacturingDateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ManufacturingDate response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceConfigurationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadPowerSourceConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributePowerSourceConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PartNumber + * Attribute AttributeList */ -class ReadBasicInformationPartNumber : public ReadAttribute { +class ReadPowerSourceConfigurationAttributeList : public ReadAttribute { public: - ReadBasicInformationPartNumber() - : ReadAttribute("part-number") - { - } - - ~ReadBasicInformationPartNumber() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePartNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.PartNumber response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation PartNumber read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceConfigurationAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadPowerSourceConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributePowerSourceConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationPartNumber : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadPowerSourceConfigurationFeatureMap : public ReadAttribute { public: - SubscribeAttributeBasicInformationPartNumber() - : SubscribeAttribute("part-number") - { - } - - ~SubscribeAttributeBasicInformationPartNumber() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePartNumberWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.PartNumber response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceConfigurationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadPowerSourceConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributePowerSourceConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductURL + * Attribute ClusterRevision */ -class ReadBasicInformationProductURL : public ReadAttribute { +class ReadPowerSourceConfigurationClusterRevision : public ReadAttribute { public: - ReadBasicInformationProductURL() - : ReadAttribute("product-url") - { - } - - ~ReadBasicInformationProductURL() {} + ReadPowerSourceConfigurationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadPowerSourceConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSourceConfiguration ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceConfigurationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceConfigurationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributePowerSourceConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000D) on endpoint %u", endpointId); +/*----------------------------------------------------------------------------*\ +| Cluster PowerSource | 0x002F | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Status | 0x0000 | +| * Order | 0x0001 | +| * Description | 0x0002 | +| * WiredAssessedInputVoltage | 0x0003 | +| * WiredAssessedInputFrequency | 0x0004 | +| * WiredCurrentType | 0x0005 | +| * WiredAssessedCurrent | 0x0006 | +| * WiredNominalVoltage | 0x0007 | +| * WiredMaximumCurrent | 0x0008 | +| * WiredPresent | 0x0009 | +| * ActiveWiredFaults | 0x000A | +| * BatVoltage | 0x000B | +| * BatPercentRemaining | 0x000C | +| * BatTimeRemaining | 0x000D | +| * BatChargeLevel | 0x000E | +| * BatReplacementNeeded | 0x000F | +| * BatReplaceability | 0x0010 | +| * BatPresent | 0x0011 | +| * ActiveBatFaults | 0x0012 | +| * BatReplacementDescription | 0x0013 | +| * BatCommonDesignation | 0x0014 | +| * BatANSIDesignation | 0x0015 | +| * BatIECDesignation | 0x0016 | +| * BatApprovedChemistry | 0x0017 | +| * BatCapacity | 0x0018 | +| * BatQuantity | 0x0019 | +| * BatChargeState | 0x001A | +| * BatTimeToFullCharge | 0x001B | +| * BatFunctionalWhileCharging | 0x001C | +| * BatChargingCurrent | 0x001D | +| * ActiveBatChargeFaults | 0x001E | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductURL response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ProductURL read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Status + */ +class ReadPowerSourceStatus : public ReadAttribute { +public: + ReadPowerSourceStatus() : ReadAttribute("status") {} + + ~ReadPowerSourceStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStatusWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSource.Status response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource Status read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationProductURL : public SubscribeAttribute { +class SubscribeAttributePowerSourceStatus : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationProductURL() - : SubscribeAttribute("product-url") - { - } + SubscribeAttributePowerSourceStatus() : SubscribeAttribute("status") {} - ~SubscribeAttributeBasicInformationProductURL() {} + ~SubscribeAttributePowerSourceStatus() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeProductURLWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductURL response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.Status response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductLabel + * Attribute Order */ -class ReadBasicInformationProductLabel : public ReadAttribute { +class ReadPowerSourceOrder : public ReadAttribute { public: - ReadBasicInformationProductLabel() - : ReadAttribute("product-label") - { - } - - ~ReadBasicInformationProductLabel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductLabel response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ProductLabel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceOrder() : ReadAttribute("order") {} + + ~ReadPowerSourceOrder() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOrderWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSource.Order response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource Order read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationProductLabel : public SubscribeAttribute { +class SubscribeAttributePowerSourceOrder : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationProductLabel() - : SubscribeAttribute("product-label") - { - } + SubscribeAttributePowerSourceOrder() : SubscribeAttribute("order") {} - ~SubscribeAttributeBasicInformationProductLabel() {} + ~SubscribeAttributePowerSourceOrder() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOrderWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeProductLabelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ProductLabel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.Order response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SerialNumber + * Attribute Description */ -class ReadBasicInformationSerialNumber : public ReadAttribute { +class ReadPowerSourceDescription : public ReadAttribute { public: - ReadBasicInformationSerialNumber() - : ReadAttribute("serial-number") - { - } - - ~ReadBasicInformationSerialNumber() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSerialNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SerialNumber response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation SerialNumber read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceDescription() : ReadAttribute("description") {} + + ~ReadPowerSourceDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDescriptionWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.Description response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource Description read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationSerialNumber : public SubscribeAttribute { +class SubscribeAttributePowerSourceDescription : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationSerialNumber() - : SubscribeAttribute("serial-number") - { - } + SubscribeAttributePowerSourceDescription() + : SubscribeAttribute("description") {} - ~SubscribeAttributeBasicInformationSerialNumber() {} + ~SubscribeAttributePowerSourceDescription() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDescriptionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSerialNumberWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.SerialNumber response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.Description response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute LocalConfigDisabled + * Attribute WiredAssessedInputVoltage */ -class ReadBasicInformationLocalConfigDisabled : public ReadAttribute { +class ReadPowerSourceWiredAssessedInputVoltage : public ReadAttribute { public: - ReadBasicInformationLocalConfigDisabled() - : ReadAttribute("local-config-disabled") - { - } - - ~ReadBasicInformationLocalConfigDisabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLocalConfigDisabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.LocalConfigDisabled response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation LocalConfigDisabled read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceWiredAssessedInputVoltage() + : ReadAttribute("wired-assessed-input-voltage") {} + + ~ReadPowerSourceWiredAssessedInputVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredAssessedInputVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource WiredAssessedInputVoltage read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredAssessedInputVoltage + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredAssessedInputVoltage() + : SubscribeAttribute("wired-assessed-input-voltage") {} + + ~SubscribeAttributePowerSourceWiredAssessedInputVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredAssessedInputVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteBasicInformationLocalConfigDisabled : public WriteAttribute { +/* + * Attribute WiredAssessedInputFrequency + */ +class ReadPowerSourceWiredAssessedInputFrequency : public ReadAttribute { public: - WriteBasicInformationLocalConfigDisabled() - : WriteAttribute("local-config-disabled") - { - AddArgument("attr-name", "local-config-disabled"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBasicInformationLocalConfigDisabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeLocalConfigDisabledWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BasicInformation LocalConfigDisabled write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; + ReadPowerSourceWiredAssessedInputFrequency() + : ReadAttribute("wired-assessed-input-frequency") {} + + ~ReadPowerSourceWiredAssessedInputFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredAssessedInputFrequencyWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource WiredAssessedInputFrequency read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredAssessedInputFrequency + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredAssessedInputFrequency() + : SubscribeAttribute("wired-assessed-input-frequency") {} + + ~SubscribeAttributePowerSourceWiredAssessedInputFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredAssessedInputFrequencyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationLocalConfigDisabled : public SubscribeAttribute { +/* + * Attribute WiredCurrentType + */ +class ReadPowerSourceWiredCurrentType : public ReadAttribute { public: - SubscribeAttributeBasicInformationLocalConfigDisabled() - : SubscribeAttribute("local-config-disabled") - { - } - - ~SubscribeAttributeBasicInformationLocalConfigDisabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocalConfigDisabledWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.LocalConfigDisabled response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceWiredCurrentType() : ReadAttribute("wired-current-type") {} + + ~ReadPowerSourceWiredCurrentType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredCurrentTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredCurrentType response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource WiredCurrentType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredCurrentType + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredCurrentType() + : SubscribeAttribute("wired-current-type") {} + + ~SubscribeAttributePowerSourceWiredCurrentType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredCurrentTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredCurrentType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Reachable + * Attribute WiredAssessedCurrent */ -class ReadBasicInformationReachable : public ReadAttribute { +class ReadPowerSourceWiredAssessedCurrent : public ReadAttribute { public: - ReadBasicInformationReachable() - : ReadAttribute("reachable") - { - } + ReadPowerSourceWiredAssessedCurrent() + : ReadAttribute("wired-assessed-current") {} + + ~ReadPowerSourceWiredAssessedCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredAssessedCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource WiredAssessedCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredAssessedCurrent + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredAssessedCurrent() + : SubscribeAttribute("wired-assessed-current") {} + + ~SubscribeAttributePowerSourceWiredAssessedCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredAssessedCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredAssessedCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadBasicInformationReachable() {} +/* + * Attribute WiredNominalVoltage + */ +class ReadPowerSourceWiredNominalVoltage : public ReadAttribute { +public: + ReadPowerSourceWiredNominalVoltage() + : ReadAttribute("wired-nominal-voltage") {} + + ~ReadPowerSourceWiredNominalVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredNominalVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredNominalVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource WiredNominalVoltage read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredNominalVoltage + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredNominalVoltage() + : SubscribeAttribute("wired-nominal-voltage") {} + + ~SubscribeAttributePowerSourceWiredNominalVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredNominalVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredNominalVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000011) on endpoint %u", endpointId); +/* + * Attribute WiredMaximumCurrent + */ +class ReadPowerSourceWiredMaximumCurrent : public ReadAttribute { +public: + ReadPowerSourceWiredMaximumCurrent() + : ReadAttribute("wired-maximum-current") {} + + ~ReadPowerSourceWiredMaximumCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredMaximumCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredMaximumCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource WiredMaximumCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceWiredMaximumCurrent + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceWiredMaximumCurrent() + : SubscribeAttribute("wired-maximum-current") {} + + ~SubscribeAttributePowerSourceWiredMaximumCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredMaximumCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredMaximumCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReachableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.Reachable response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation Reachable read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute WiredPresent + */ +class ReadPowerSourceWiredPresent : public ReadAttribute { +public: + ReadPowerSourceWiredPresent() : ReadAttribute("wired-present") {} + + ~ReadPowerSourceWiredPresent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiredPresentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredPresent response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource WiredPresent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationReachable : public SubscribeAttribute { +class SubscribeAttributePowerSourceWiredPresent : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationReachable() - : SubscribeAttribute("reachable") - { - } + SubscribeAttributePowerSourceWiredPresent() + : SubscribeAttribute("wired-present") {} - ~SubscribeAttributeBasicInformationReachable() {} + ~SubscribeAttributePowerSourceWiredPresent() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiredPresentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeReachableWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.Reachable response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.WiredPresent response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute UniqueID + * Attribute ActiveWiredFaults */ -class ReadBasicInformationUniqueID : public ReadAttribute { +class ReadPowerSourceActiveWiredFaults : public ReadAttribute { public: - ReadBasicInformationUniqueID() - : ReadAttribute("unique-id") - { - } - - ~ReadBasicInformationUniqueID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000012) on endpoint %u", endpointId); + ReadPowerSourceActiveWiredFaults() : ReadAttribute("active-wired-faults") {} + + ~ReadPowerSourceActiveWiredFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveWiredFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveWiredFaults response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource ActiveWiredFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceActiveWiredFaults + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceActiveWiredFaults() + : SubscribeAttribute("active-wired-faults") {} + + ~SubscribeAttributePowerSourceActiveWiredFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveWiredFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveWiredFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUniqueIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.UniqueID response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation UniqueID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute BatVoltage + */ +class ReadPowerSourceBatVoltage : public ReadAttribute { +public: + ReadPowerSourceBatVoltage() : ReadAttribute("bat-voltage") {} + + ~ReadPowerSourceBatVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatVoltageWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSource.BatVoltage response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatVoltage read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationUniqueID : public SubscribeAttribute { +class SubscribeAttributePowerSourceBatVoltage : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationUniqueID() - : SubscribeAttribute("unique-id") - { - } + SubscribeAttributePowerSourceBatVoltage() + : SubscribeAttribute("bat-voltage") {} - ~SubscribeAttributeBasicInformationUniqueID() {} + ~SubscribeAttributePowerSourceBatVoltage() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeUniqueIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.UniqueID response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatVoltage response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CapabilityMinima + * Attribute BatPercentRemaining */ -class ReadBasicInformationCapabilityMinima : public ReadAttribute { +class ReadPowerSourceBatPercentRemaining : public ReadAttribute { public: - ReadBasicInformationCapabilityMinima() - : ReadAttribute("capability-minima") - { - } - - ~ReadBasicInformationCapabilityMinima() {} + ReadPowerSourceBatPercentRemaining() + : ReadAttribute("bat-percent-remaining") {} + + ~ReadPowerSourceBatPercentRemaining() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatPercentRemainingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatPercentRemaining response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatPercentRemaining read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatPercentRemaining + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatPercentRemaining() + : SubscribeAttribute("bat-percent-remaining") {} + + ~SubscribeAttributePowerSourceBatPercentRemaining() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatPercentRemainingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatPercentRemaining response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x00000013) on endpoint %u", endpointId); +/* + * Attribute BatTimeRemaining + */ +class ReadPowerSourceBatTimeRemaining : public ReadAttribute { +public: + ReadPowerSourceBatTimeRemaining() : ReadAttribute("bat-time-remaining") {} + + ~ReadPowerSourceBatTimeRemaining() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatTimeRemainingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatTimeRemaining response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatTimeRemaining read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatTimeRemaining + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatTimeRemaining() + : SubscribeAttribute("bat-time-remaining") {} + + ~SubscribeAttributePowerSourceBatTimeRemaining() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatTimeRemainingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatTimeRemaining response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCapabilityMinimaWithCompletion:^( - MTRBasicInformationClusterCapabilityMinimaStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.CapabilityMinima response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation CapabilityMinima read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute BatChargeLevel + */ +class ReadPowerSourceBatChargeLevel : public ReadAttribute { +public: + ReadPowerSourceBatChargeLevel() : ReadAttribute("bat-charge-level") {} + + ~ReadPowerSourceBatChargeLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatChargeLevelWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatChargeLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationCapabilityMinima : public SubscribeAttribute { +class SubscribeAttributePowerSourceBatChargeLevel : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationCapabilityMinima() - : SubscribeAttribute("capability-minima") - { - } + SubscribeAttributePowerSourceBatChargeLevel() + : SubscribeAttribute("bat-charge-level") {} - ~SubscribeAttributeBasicInformationCapabilityMinima() {} + ~SubscribeAttributePowerSourceBatChargeLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatChargeLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCapabilityMinimaWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRBasicInformationClusterCapabilityMinimaStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.CapabilityMinima response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute BatReplacementNeeded */ -class ReadBasicInformationGeneratedCommandList : public ReadAttribute { +class ReadPowerSourceBatReplacementNeeded : public ReadAttribute { public: - ReadBasicInformationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBasicInformationGeneratedCommandList() {} + ReadPowerSourceBatReplacementNeeded() + : ReadAttribute("bat-replacement-needed") {} + + ~ReadPowerSourceBatReplacementNeeded() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatReplacementNeededWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplacementNeeded response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatReplacementNeeded read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatReplacementNeeded + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatReplacementNeeded() + : SubscribeAttribute("bat-replacement-needed") {} + + ~SubscribeAttributePowerSourceBatReplacementNeeded() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatReplacementNeededWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplacementNeeded response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +/* + * Attribute BatReplaceability + */ +class ReadPowerSourceBatReplaceability : public ReadAttribute { +public: + ReadPowerSourceBatReplaceability() : ReadAttribute("bat-replaceability") {} + + ~ReadPowerSourceBatReplaceability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatReplaceabilityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplaceability response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatReplaceability read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatReplaceability + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatReplaceability() + : SubscribeAttribute("bat-replaceability") {} + + ~SubscribeAttributePowerSourceBatReplaceability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatReplaceabilityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplaceability response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute BatPresent + */ +class ReadPowerSourceBatPresent : public ReadAttribute { +public: + ReadPowerSourceBatPresent() : ReadAttribute("bat-present") {} + + ~ReadPowerSourceBatPresent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatPresentWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSource.BatPresent response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatPresent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributePowerSourceBatPresent : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributePowerSourceBatPresent() + : SubscribeAttribute("bat-present") {} - ~SubscribeAttributeBasicInformationGeneratedCommandList() {} + ~SubscribeAttributePowerSourceBatPresent() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatPresentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatPresent response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute ActiveBatFaults */ -class ReadBasicInformationAcceptedCommandList : public ReadAttribute { +class ReadPowerSourceActiveBatFaults : public ReadAttribute { public: - ReadBasicInformationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBasicInformationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceActiveBatFaults() : ReadAttribute("active-bat-faults") {} + + ~ReadPowerSourceActiveBatFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveBatFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveBatFaults response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource ActiveBatFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributePowerSourceActiveBatFaults : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributePowerSourceActiveBatFaults() + : SubscribeAttribute("active-bat-faults") {} - ~SubscribeAttributeBasicInformationAcceptedCommandList() {} + ~SubscribeAttributePowerSourceActiveBatFaults() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveBatFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveBatFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute BatReplacementDescription */ -class ReadBasicInformationAttributeList : public ReadAttribute { +class ReadPowerSourceBatReplacementDescription : public ReadAttribute { public: - ReadBasicInformationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadBasicInformationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceBatReplacementDescription() + : ReadAttribute("bat-replacement-description") {} + + ~ReadPowerSourceBatReplacementDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatReplacementDescriptionWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplacementDescription response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatReplacementDescription read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatReplacementDescription + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatReplacementDescription() + : SubscribeAttribute("bat-replacement-description") {} + + ~SubscribeAttributePowerSourceBatReplacementDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatReplacementDescriptionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatReplacementDescription response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationAttributeList : public SubscribeAttribute { +/* + * Attribute BatCommonDesignation + */ +class ReadPowerSourceBatCommonDesignation : public ReadAttribute { public: - SubscribeAttributeBasicInformationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeBasicInformationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceBatCommonDesignation() + : ReadAttribute("bat-common-designation") {} + + ~ReadPowerSourceBatCommonDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatCommonDesignationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatCommonDesignation response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatCommonDesignation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatCommonDesignation + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatCommonDesignation() + : SubscribeAttribute("bat-common-designation") {} + + ~SubscribeAttributePowerSourceBatCommonDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatCommonDesignationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatCommonDesignation response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute BatANSIDesignation */ -class ReadBasicInformationFeatureMap : public ReadAttribute { +class ReadPowerSourceBatANSIDesignation : public ReadAttribute { public: - ReadBasicInformationFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadPowerSourceBatANSIDesignation() : ReadAttribute("bat-ansidesignation") {} + + ~ReadPowerSourceBatANSIDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatANSIDesignationWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatANSIDesignation response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatANSIDesignation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatANSIDesignation + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatANSIDesignation() + : SubscribeAttribute("bat-ansidesignation") {} + + ~SubscribeAttributePowerSourceBatANSIDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatANSIDesignationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatANSIDesignation response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadBasicInformationFeatureMap() {} +/* + * Attribute BatIECDesignation + */ +class ReadPowerSourceBatIECDesignation : public ReadAttribute { +public: + ReadPowerSourceBatIECDesignation() : ReadAttribute("bat-iecdesignation") {} + + ~ReadPowerSourceBatIECDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatIECDesignationWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatIECDesignation response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatIECDesignation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatIECDesignation + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatIECDesignation() + : SubscribeAttribute("bat-iecdesignation") {} + + ~SubscribeAttributePowerSourceBatIECDesignation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatIECDesignationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatIECDesignation response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +/* + * Attribute BatApprovedChemistry + */ +class ReadPowerSourceBatApprovedChemistry : public ReadAttribute { +public: + ReadPowerSourceBatApprovedChemistry() + : ReadAttribute("bat-approved-chemistry") {} + + ~ReadPowerSourceBatApprovedChemistry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatApprovedChemistryWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatApprovedChemistry response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatApprovedChemistry read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatApprovedChemistry + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatApprovedChemistry() + : SubscribeAttribute("bat-approved-chemistry") {} + + ~SubscribeAttributePowerSourceBatApprovedChemistry() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatApprovedChemistryWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatApprovedChemistry response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute BatCapacity + */ +class ReadPowerSourceBatCapacity : public ReadAttribute { +public: + ReadPowerSourceBatCapacity() : ReadAttribute("bat-capacity") {} + + ~ReadPowerSourceBatCapacity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatCapacityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatCapacity response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatCapacity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBasicInformationFeatureMap : public SubscribeAttribute { +class SubscribeAttributePowerSourceBatCapacity : public SubscribeAttribute { public: - SubscribeAttributeBasicInformationFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributePowerSourceBatCapacity() + : SubscribeAttribute("bat-capacity") {} - ~SubscribeAttributeBasicInformationFeatureMap() {} + ~SubscribeAttributePowerSourceBatCapacity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatCapacityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatCapacity response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute BatQuantity */ -class ReadBasicInformationClusterRevision : public ReadAttribute { +class ReadPowerSourceBatQuantity : public ReadAttribute { public: - ReadBasicInformationClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadPowerSourceBatQuantity() : ReadAttribute("bat-quantity") {} + + ~ReadPowerSourceBatQuantity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatQuantityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatQuantity response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatQuantity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadBasicInformationClusterRevision() {} +class SubscribeAttributePowerSourceBatQuantity : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatQuantity() + : SubscribeAttribute("bat-quantity") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributePowerSourceBatQuantity() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BasicInformation ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeBasicInformationClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeBasicInformationClusterRevision() - : SubscribeAttribute("cluster-revision") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeBasicInformationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000028) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatQuantityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BasicInformation.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatQuantity response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster OtaSoftwareUpdateProvider | 0x0029 | -|------------------------------------------------------------------------------| -| Commands: | | -| * QueryImage | 0x00 | -| * ApplyUpdateRequest | 0x02 | -| * NotifyUpdateApplied | 0x04 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Command QueryImage + * Attribute BatChargeState */ -class OtaSoftwareUpdateProviderQueryImage : public ClusterCommand { +class ReadPowerSourceBatChargeState : public ReadAttribute { public: - OtaSoftwareUpdateProviderQueryImage() - : ClusterCommand("query-image") - , mComplex_ProtocolsSupported(&mRequest.protocolsSupported) - { - AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); - AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); - AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); - AddArgument("ProtocolsSupported", &mComplex_ProtocolsSupported); - AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); - AddArgument("Location", &mRequest.location); - AddArgument("RequestorCanConsent", 0, 1, &mRequest.requestorCanConsent); - AddArgument("MetadataForProvider", &mRequest.metadataForProvider); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROTASoftwareUpdateProviderClusterQueryImageParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.vendorId = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorId)]; - params.productId = [NSNumber numberWithUnsignedShort:mRequest.productId]; - params.softwareVersion = [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.protocolsSupported) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - params.protocolsSupported = array_0; - } - if (mRequest.hardwareVersion.HasValue()) { - params.hardwareVersion = [NSNumber numberWithUnsignedShort:mRequest.hardwareVersion.Value()]; - } else { - params.hardwareVersion = nil; - } - if (mRequest.location.HasValue()) { - params.location = [[NSString alloc] initWithBytes:mRequest.location.Value().data() - length:mRequest.location.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.location = nil; - } - if (mRequest.requestorCanConsent.HasValue()) { - params.requestorCanConsent = [NSNumber numberWithBool:mRequest.requestorCanConsent.Value()]; - } else { - params.requestorCanConsent = nil; - } - if (mRequest.metadataForProvider.HasValue()) { - params.metadataForProvider = [NSData dataWithBytes:mRequest.metadataForProvider.Value().data() - length:mRequest.metadataForProvider.Value().size()]; - } else { - params.metadataForProvider = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster queryImageWithParams:params - completion:^(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ReadPowerSourceBatChargeState() : ReadAttribute("bat-charge-state") {} + + ~ReadPowerSourceBatChargeState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatChargeStateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargeState response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatChargeState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatChargeState : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatChargeState() + : SubscribeAttribute("bat-charge-state") {} + + ~SubscribeAttributePowerSourceBatChargeState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeBatChargeStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargeState response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type mRequest; - TypedComplexArgument> - mComplex_ProtocolsSupported; + return CHIP_NO_ERROR; + } }; /* - * Command ApplyUpdateRequest + * Attribute BatTimeToFullCharge */ -class OtaSoftwareUpdateProviderApplyUpdateRequest : public ClusterCommand { +class ReadPowerSourceBatTimeToFullCharge : public ReadAttribute { public: - OtaSoftwareUpdateProviderApplyUpdateRequest() - : ClusterCommand("apply-update-request") - { - AddArgument("UpdateToken", &mRequest.updateToken); - AddArgument("NewVersion", 0, UINT32_MAX, &mRequest.newVersion); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() length:mRequest.updateToken.size()]; - params.newVersion = [NSNumber numberWithUnsignedInt:mRequest.newVersion]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster applyUpdateRequestWithParams:params - completion:^(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type mRequest; + ReadPowerSourceBatTimeToFullCharge() + : ReadAttribute("bat-time-to-full-charge") {} + + ~ReadPowerSourceBatTimeToFullCharge() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatTimeToFullChargeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatTimeToFullCharge response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatTimeToFullCharge read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatTimeToFullCharge + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatTimeToFullCharge() + : SubscribeAttribute("bat-time-to-full-charge") {} + + ~SubscribeAttributePowerSourceBatTimeToFullCharge() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatTimeToFullChargeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatTimeToFullCharge response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command NotifyUpdateApplied + * Attribute BatFunctionalWhileCharging */ -class OtaSoftwareUpdateProviderNotifyUpdateApplied : public ClusterCommand { +class ReadPowerSourceBatFunctionalWhileCharging : public ReadAttribute { public: - OtaSoftwareUpdateProviderNotifyUpdateApplied() - : ClusterCommand("notify-update-applied") - { - AddArgument("UpdateToken", &mRequest.updateToken); - AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() length:mRequest.updateToken.size()]; - params.softwareVersion = [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster notifyUpdateAppliedWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Type mRequest; + ReadPowerSourceBatFunctionalWhileCharging() + : ReadAttribute("bat-functional-while-charging") {} + + ~ReadPowerSourceBatFunctionalWhileCharging() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatFunctionalWhileChargingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource BatFunctionalWhileCharging read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatFunctionalWhileCharging + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatFunctionalWhileCharging() + : SubscribeAttribute("bat-functional-while-charging") {} + + ~SubscribeAttributePowerSourceBatFunctionalWhileCharging() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatFunctionalWhileChargingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute BatChargingCurrent */ -class ReadOtaSoftwareUpdateProviderGeneratedCommandList : public ReadAttribute { +class ReadPowerSourceBatChargingCurrent : public ReadAttribute { public: - ReadOtaSoftwareUpdateProviderGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadOtaSoftwareUpdateProviderGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateProvider GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceBatChargingCurrent() : ReadAttribute("bat-charging-current") {} + + ~ReadPowerSourceBatChargingCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBatChargingCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargingCurrent response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource BatChargingCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceBatChargingCurrent + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceBatChargingCurrent() + : SubscribeAttribute("bat-charging-current") {} + + ~SubscribeAttributePowerSourceBatChargingCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBatChargingCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.BatChargingCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList : public SubscribeAttribute { +/* + * Attribute ActiveBatChargeFaults + */ +class ReadPowerSourceActiveBatChargeFaults : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceActiveBatChargeFaults() + : ReadAttribute("active-bat-charge-faults") {} + + ~ReadPowerSourceActiveBatChargeFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveBatChargeFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveBatChargeFaults response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource ActiveBatChargeFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceActiveBatChargeFaults + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceActiveBatChargeFaults() + : SubscribeAttribute("active-bat-charge-faults") {} + + ~SubscribeAttributePowerSourceActiveBatChargeFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveBatChargeFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ActiveBatChargeFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute GeneratedCommandList */ -class ReadOtaSoftwareUpdateProviderAcceptedCommandList : public ReadAttribute { +class ReadPowerSourceGeneratedCommandList : public ReadAttribute { public: - ReadOtaSoftwareUpdateProviderAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadOtaSoftwareUpdateProviderAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateProvider AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadPowerSourceGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributePowerSourceGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadPowerSourceAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPowerSourceAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadPowerSourceAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PowerSource AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePowerSourceAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePowerSourceAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributePowerSourceAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadOtaSoftwareUpdateProviderAttributeList : public ReadAttribute { +class ReadPowerSourceAttributeList : public ReadAttribute { public: - ReadOtaSoftwareUpdateProviderAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadOtaSoftwareUpdateProviderAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateProvider AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadPowerSourceAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateProviderAttributeList : public SubscribeAttribute { +class SubscribeAttributePowerSourceAttributeList : public SubscribeAttribute { public: - SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributePowerSourceAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() {} + ~SubscribeAttributePowerSourceAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadOtaSoftwareUpdateProviderFeatureMap : public ReadAttribute { +class ReadPowerSourceFeatureMap : public ReadAttribute { public: - ReadOtaSoftwareUpdateProviderFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadOtaSoftwareUpdateProviderFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateProvider FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadPowerSourceFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PowerSource.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap : public SubscribeAttribute { +class SubscribeAttributePowerSourceFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributePowerSourceFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() {} + ~SubscribeAttributePowerSourceFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadOtaSoftwareUpdateProviderClusterRevision : public ReadAttribute { +class ReadPowerSourceClusterRevision : public ReadAttribute { public: - ReadOtaSoftwareUpdateProviderClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadOtaSoftwareUpdateProviderClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateProvider ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPowerSourceClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadPowerSourceClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("PowerSource ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision : public SubscribeAttribute { +class SubscribeAttributePowerSourceClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributePowerSourceClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() {} + ~SubscribeAttributePowerSourceClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000029) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterPowerSource alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PowerSource.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster OtaSoftwareUpdateRequestor | 0x002A | +| Cluster GeneralCommissioning | 0x0030 | |------------------------------------------------------------------------------| | Commands: | | -| * AnnounceOtaProvider | 0x00 | +| * ArmFailSafe | 0x00 | +| * SetRegulatoryConfig | 0x02 | +| * CommissioningComplete | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | -| * DefaultOtaProviders | 0x0000 | -| * UpdatePossible | 0x0001 | -| * UpdateState | 0x0002 | -| * UpdateStateProgress | 0x0003 | +| * Breadcrumb | 0x0000 | +| * BasicCommissioningInfo | 0x0001 | +| * RegulatoryConfig | 0x0002 | +| * LocationCapability | 0x0003 | +| * SupportsConcurrentConnection | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -13415,772 +22074,1099 @@ class SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision : public Subscr | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * StateTransition | 0x0000 | -| * VersionApplied | 0x0001 | -| * DownloadError | 0x0002 | \*----------------------------------------------------------------------------*/ /* - * Command AnnounceOtaProvider + * Command ArmFailSafe */ -class OtaSoftwareUpdateRequestorAnnounceOtaProvider : public ClusterCommand { +class GeneralCommissioningArmFailSafe : public ClusterCommand { public: - OtaSoftwareUpdateRequestorAnnounceOtaProvider() - : ClusterCommand("announce-ota-provider") - { - AddArgument("ProviderNodeId", 0, UINT64_MAX, &mRequest.providerNodeId); - AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); - AddArgument("AnnouncementReason", 0, UINT8_MAX, &mRequest.announcementReason); - AddArgument("MetadataForNode", &mRequest.metadataForNode); - AddArgument("Endpoint", 0, UINT16_MAX, &mRequest.endpoint); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROTASoftwareUpdateRequestorClusterAnnounceOtaProviderParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.providerNodeId = [NSNumber numberWithUnsignedLongLong:mRequest.providerNodeId]; - params.vendorId = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorId)]; - params.announcementReason = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.announcementReason)]; - if (mRequest.metadataForNode.HasValue()) { - params.metadataForNode = [NSData dataWithBytes:mRequest.metadataForNode.Value().data() - length:mRequest.metadataForNode.Value().size()]; - } else { - params.metadataForNode = nil; - } - params.endpoint = [NSNumber numberWithUnsignedShort:mRequest.endpoint]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster announceOtaProviderWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GeneralCommissioningArmFailSafe() : ClusterCommand("arm-fail-safe") { + AddArgument("ExpiryLengthSeconds", 0, UINT16_MAX, + &mRequest.expiryLengthSeconds); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000030) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGeneralCommissioningClusterArmFailSafeParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.expiryLengthSeconds = + [NSNumber numberWithUnsignedShort:mRequest.expiryLengthSeconds]; + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + armFailSafeWithParams:params + completion:^( + MTRGeneralCommissioningClusterArmFailSafeResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::Type mRequest; + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type + mRequest; }; /* - * Attribute DefaultOtaProviders + * Command SetRegulatoryConfig */ -class ReadOtaSoftwareUpdateRequestorDefaultOtaProviders : public ReadAttribute { +class GeneralCommissioningSetRegulatoryConfig : public ClusterCommand { public: - ReadOtaSoftwareUpdateRequestorDefaultOtaProviders() - : ReadAttribute("default-ota-providers") - { - } - - ~ReadOtaSoftwareUpdateRequestorDefaultOtaProviders() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster - readAttributeDefaultOtaProvidersWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.DefaultOtaProviders response %@", - [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor DefaultOtaProviders read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOtaSoftwareUpdateRequestorDefaultOtaProviders : public WriteAttribute { -public: - WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() - : WriteAttribute("default-ota-providers") - , mComplex(&mValue) - { - AddArgument("attr-name", "default-ota-providers"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTROTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; - newElement_0 = [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; - newElement_0.providerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; - newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster - writeAttributeDefaultOtaProvidersWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor DefaultOtaProviders write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + GeneralCommissioningSetRegulatoryConfig() + : ClusterCommand("set-regulatory-config") { + AddArgument("NewRegulatoryConfig", 0, UINT8_MAX, + &mRequest.newRegulatoryConfig); + AddArgument("CountryCode", &mRequest.countryCode); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000030) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGeneralCommissioningClusterSetRegulatoryConfigParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.newRegulatoryConfig = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.newRegulatoryConfig)]; + params.countryCode = + [[NSString alloc] initWithBytes:mRequest.countryCode.data() + length:mRequest.countryCode.size() + encoding:NSUTF8StringEncoding]; + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + setRegulatoryConfigWithParams:params + completion:^( + MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument< - chip::app::DataModel::List> - mComplex; + chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type + mRequest; }; -class SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders : public SubscribeAttribute { +/* + * Command CommissioningComplete + */ +class GeneralCommissioningCommissioningComplete : public ClusterCommand { public: - SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders() - : SubscribeAttribute("default-ota-providers") - { + GeneralCommissioningCommissioningComplete() + : ClusterCommand("commissioning-complete") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000030) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGeneralCommissioningClusterCommissioningCompleteParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + commissioningCompleteWithParams:params + completion:^( + MTRGeneralCommissioningClusterCommissioningCompleteResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDefaultOtaProvidersWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.DefaultOtaProviders response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute UpdatePossible + * Attribute Breadcrumb */ -class ReadOtaSoftwareUpdateRequestorUpdatePossible : public ReadAttribute { +class ReadGeneralCommissioningBreadcrumb : public ReadAttribute { public: - ReadOtaSoftwareUpdateRequestorUpdatePossible() - : ReadAttribute("update-possible") - { - } - - ~ReadOtaSoftwareUpdateRequestorUpdatePossible() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUpdatePossibleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor UpdatePossible read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningBreadcrumb() : ReadAttribute("breadcrumb") {} + + ~ReadGeneralCommissioningBreadcrumb() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.Breadcrumb response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning Breadcrumb read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible : public SubscribeAttribute { +class WriteGeneralCommissioningBreadcrumb : public WriteAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() - : SubscribeAttribute("update-possible") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUpdatePossibleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", [value description]); - SetCommandExitStatus(error); - }]; + WriteGeneralCommissioningBreadcrumb() : WriteAttribute("breadcrumb") { + AddArgument("attr-name", "breadcrumb"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteGeneralCommissioningBreadcrumb() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster writeAttributeBreadcrumbWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("GeneralCommissioning " + "Breadcrumb write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: + uint64_t mValue; }; -/* - * Attribute UpdateState - */ -class ReadOtaSoftwareUpdateRequestorUpdateState : public ReadAttribute { +class SubscribeAttributeGeneralCommissioningBreadcrumb + : public SubscribeAttribute { public: - ReadOtaSoftwareUpdateRequestorUpdateState() - : ReadAttribute("update-state") - { - } + SubscribeAttributeGeneralCommissioningBreadcrumb() + : SubscribeAttribute("breadcrumb") {} - ~ReadOtaSoftwareUpdateRequestorUpdateState() {} + ~SubscribeAttributeGeneralCommissioningBreadcrumb() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUpdateStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor UpdateState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState : public SubscribeAttribute { -public: - SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() - : SubscribeAttribute("update-state") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBreadcrumbWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeUpdateStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.Breadcrumb response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute UpdateStateProgress + * Attribute BasicCommissioningInfo */ -class ReadOtaSoftwareUpdateRequestorUpdateStateProgress : public ReadAttribute { +class ReadGeneralCommissioningBasicCommissioningInfo : public ReadAttribute { public: - ReadOtaSoftwareUpdateRequestorUpdateStateProgress() - : ReadAttribute("update-state-progress") - { - } - - ~ReadOtaSoftwareUpdateRequestorUpdateStateProgress() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUpdateStateProgressWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor UpdateStateProgress read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningBasicCommissioningInfo() + : ReadAttribute("basic-commissioning-info") {} + + ~ReadGeneralCommissioningBasicCommissioningInfo() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBasicCommissioningInfoWithCompletion:^( + MTRGeneralCommissioningClusterBasicCommissioningInfo + *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning BasicCommissioningInfo read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() + : SubscribeAttribute("basic-commissioning-info") {} + + ~SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBasicCommissioningInfoWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(MTRGeneralCommissioningClusterBasicCommissioningInfo + *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress : public SubscribeAttribute { +/* + * Attribute RegulatoryConfig + */ +class ReadGeneralCommissioningRegulatoryConfig : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() - : SubscribeAttribute("update-state-progress") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUpdateStateProgressWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningRegulatoryConfig() + : ReadAttribute("regulatory-config") {} + + ~ReadGeneralCommissioningRegulatoryConfig() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRegulatoryConfigWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning RegulatoryConfig read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningRegulatoryConfig + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningRegulatoryConfig() + : SubscribeAttribute("regulatory-config") {} + + ~SubscribeAttributeGeneralCommissioningRegulatoryConfig() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRegulatoryConfigWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute LocationCapability */ -class ReadOtaSoftwareUpdateRequestorGeneratedCommandList : public ReadAttribute { +class ReadGeneralCommissioningLocationCapability : public ReadAttribute { public: - ReadOtaSoftwareUpdateRequestorGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadOtaSoftwareUpdateRequestorGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningLocationCapability() + : ReadAttribute("location-capability") {} + + ~ReadGeneralCommissioningLocationCapability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocationCapabilityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.LocationCapability response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning LocationCapability read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningLocationCapability + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningLocationCapability() + : SubscribeAttribute("location-capability") {} + + ~SubscribeAttributeGeneralCommissioningLocationCapability() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocationCapabilityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.LocationCapability response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute SupportsConcurrentConnection + */ +class ReadGeneralCommissioningSupportsConcurrentConnection + : public ReadAttribute { +public: + ReadGeneralCommissioningSupportsConcurrentConnection() + : ReadAttribute("supports-concurrent-connection") {} + + ~ReadGeneralCommissioningSupportsConcurrentConnection() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.SupportsConcurrentConnection response %@", + [value description]); + if (error != nil) { + LogNSError( + "GeneralCommissioning SupportsConcurrentConnection read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() + : SubscribeAttribute("supports-concurrent-connection") {} + + ~SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportsConcurrentConnectionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"GeneralCommissioning.SupportsConcurrentConnection response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute GeneratedCommandList */ -class ReadOtaSoftwareUpdateRequestorAcceptedCommandList : public ReadAttribute { +class ReadGeneralCommissioningGeneratedCommandList : public ReadAttribute { public: - ReadOtaSoftwareUpdateRequestorAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadOtaSoftwareUpdateRequestorAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadGeneralCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeGeneralCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadGeneralCommissioningAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadGeneralCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeGeneralCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadOtaSoftwareUpdateRequestorAttributeList : public ReadAttribute { -public: - ReadOtaSoftwareUpdateRequestorAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadOtaSoftwareUpdateRequestorAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList : public SubscribeAttribute { +class ReadGeneralCommissioningAttributeList : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadGeneralCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeGeneralCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadOtaSoftwareUpdateRequestorFeatureMap : public ReadAttribute { -public: - ReadOtaSoftwareUpdateRequestorFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadOtaSoftwareUpdateRequestorFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap : public SubscribeAttribute { +class ReadGeneralCommissioningFeatureMap : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadGeneralCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeGeneralCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadOtaSoftwareUpdateRequestorClusterRevision : public ReadAttribute { -public: - ReadOtaSoftwareUpdateRequestorClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadOtaSoftwareUpdateRequestorClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OTASoftwareUpdateRequestor ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision : public SubscribeAttribute { +class ReadGeneralCommissioningClusterRevision : public ReadAttribute { public: - SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002A) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralCommissioningClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadGeneralCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralCommissioning ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralCommissioningClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralCommissioningClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeGeneralCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000030) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterGeneralCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralCommissioning.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster LocalizationConfiguration | 0x002B | +| Cluster NetworkCommissioning | 0x0031 | |------------------------------------------------------------------------------| | Commands: | | +| * ScanNetworks | 0x00 | +| * AddOrUpdateWiFiNetwork | 0x02 | +| * AddOrUpdateThreadNetwork | 0x03 | +| * RemoveNetwork | 0x04 | +| * ConnectNetwork | 0x06 | +| * ReorderNetwork | 0x08 | |------------------------------------------------------------------------------| | Attributes: | | -| * ActiveLocale | 0x0000 | -| * SupportedLocales | 0x0001 | +| * MaxNetworks | 0x0000 | +| * Networks | 0x0001 | +| * ScanMaxTimeSeconds | 0x0002 | +| * ConnectMaxTimeSeconds | 0x0003 | +| * InterfaceEnabled | 0x0004 | +| * LastNetworkingStatus | 0x0005 | +| * LastNetworkID | 0x0006 | +| * LastConnectErrorValue | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -14191,546 +23177,1553 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision : public Subsc \*----------------------------------------------------------------------------*/ /* - * Attribute ActiveLocale + * Command ScanNetworks */ -class ReadLocalizationConfigurationActiveLocale : public ReadAttribute { +class NetworkCommissioningScanNetworks : public ClusterCommand { public: - ReadLocalizationConfigurationActiveLocale() - : ReadAttribute("active-locale") - { + NetworkCommissioningScanNetworks() : ClusterCommand("scan-networks") { + AddArgument("Ssid", &mRequest.ssid); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterScanNetworksParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.ssid.HasValue()) { + if (mRequest.ssid.Value().IsNull()) { + params.ssid = nil; + } else { + params.ssid = + [NSData dataWithBytes:mRequest.ssid.Value().Value().data() + length:mRequest.ssid.Value().Value().size()]; + } + } else { + params.ssid = nil; + } + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + scanNetworksWithParams:params + completion:^( + MTRNetworkCommissioningClusterScanNetworksResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadLocalizationConfigurationActiveLocale() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveLocaleWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.ActiveLocale response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration ActiveLocale read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Type + mRequest; }; -class WriteLocalizationConfigurationActiveLocale : public WriteAttribute { +/* + * Command AddOrUpdateWiFiNetwork + */ +class NetworkCommissioningAddOrUpdateWiFiNetwork : public ClusterCommand { public: - WriteLocalizationConfigurationActiveLocale() - : WriteAttribute("active-locale") - { - AddArgument("attr-name", "active-locale"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteLocalizationConfigurationActiveLocale() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeActiveLocaleWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("LocalizationConfiguration ActiveLocale write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + NetworkCommissioningAddOrUpdateWiFiNetwork() + : ClusterCommand("add-or-update-wi-fi-network") { + AddArgument("Ssid", &mRequest.ssid); + AddArgument("Credentials", &mRequest.credentials); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.ssid = [NSData dataWithBytes:mRequest.ssid.data() + length:mRequest.ssid.size()]; + params.credentials = [NSData dataWithBytes:mRequest.credentials.data() + length:mRequest.credentials.size()]; + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + addOrUpdateWiFiNetworkWithParams:params + completion:^( + MTRNetworkCommissioningClusterNetworkConfigResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork:: + Type mRequest; }; -class SubscribeAttributeLocalizationConfigurationActiveLocale : public SubscribeAttribute { +/* + * Command AddOrUpdateThreadNetwork + */ +class NetworkCommissioningAddOrUpdateThreadNetwork : public ClusterCommand { public: - SubscribeAttributeLocalizationConfigurationActiveLocale() - : SubscribeAttribute("active-locale") - { + NetworkCommissioningAddOrUpdateThreadNetwork() + : ClusterCommand("add-or-update-thread-network") { + AddArgument("OperationalDataset", &mRequest.operationalDataset); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.operationalDataset = + [NSData dataWithBytes:mRequest.operationalDataset.data() + length:mRequest.operationalDataset.size()]; + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + addOrUpdateThreadNetworkWithParams:params + completion:^( + MTRNetworkCommissioningClusterNetworkConfigResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeLocalizationConfigurationActiveLocale() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveLocaleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.ActiveLocale response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::NetworkCommissioning::Commands:: + AddOrUpdateThreadNetwork::Type mRequest; }; /* - * Attribute SupportedLocales + * Command RemoveNetwork */ -class ReadLocalizationConfigurationSupportedLocales : public ReadAttribute { +class NetworkCommissioningRemoveNetwork : public ClusterCommand { public: - ReadLocalizationConfigurationSupportedLocales() - : ReadAttribute("supported-locales") - { + NetworkCommissioningRemoveNetwork() : ClusterCommand("remove-network") { + AddArgument("NetworkID", &mRequest.networkID); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterRemoveNetworkParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.networkID = [NSData dataWithBytes:mRequest.networkID.data() + length:mRequest.networkID.size()]; + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + removeNetworkWithParams:params + completion:^( + MTRNetworkCommissioningClusterNetworkConfigResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadLocalizationConfigurationSupportedLocales() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportedLocalesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.SupportedLocales response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration SupportedLocales read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Type + mRequest; }; -class SubscribeAttributeLocalizationConfigurationSupportedLocales : public SubscribeAttribute { +/* + * Command ConnectNetwork + */ +class NetworkCommissioningConnectNetwork : public ClusterCommand { public: - SubscribeAttributeLocalizationConfigurationSupportedLocales() - : SubscribeAttribute("supported-locales") - { + NetworkCommissioningConnectNetwork() : ClusterCommand("connect-network") { + AddArgument("NetworkID", &mRequest.networkID); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterConnectNetworkParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.networkID = [NSData dataWithBytes:mRequest.networkID.data() + length:mRequest.networkID.size()]; + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + connectNetworkWithParams:params + completion:^( + MTRNetworkCommissioningClusterConnectNetworkResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeLocalizationConfigurationSupportedLocales() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSupportedLocalesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.SupportedLocales response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Type + mRequest; }; /* - * Attribute GeneratedCommandList + * Command ReorderNetwork */ -class ReadLocalizationConfigurationGeneratedCommandList : public ReadAttribute { +class NetworkCommissioningReorderNetwork : public ClusterCommand { public: - ReadLocalizationConfigurationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { + NetworkCommissioningReorderNetwork() : ClusterCommand("reorder-network") { + AddArgument("NetworkID", &mRequest.networkID); + AddArgument("NetworkIndex", 0, UINT8_MAX, &mRequest.networkIndex); + AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000031) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRNetworkCommissioningClusterReorderNetworkParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.networkID = [NSData dataWithBytes:mRequest.networkID.data() + length:mRequest.networkID.size()]; + params.networkIndex = + [NSNumber numberWithUnsignedChar:mRequest.networkIndex]; + if (mRequest.breadcrumb.HasValue()) { + params.breadcrumb = + [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; + } else { + params.breadcrumb = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + reorderNetworkWithParams:params + completion:^( + MTRNetworkCommissioningClusterNetworkConfigResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadLocalizationConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Type + mRequest; }; -class SubscribeAttributeLocalizationConfigurationGeneratedCommandList : public SubscribeAttribute { +/* + * Attribute MaxNetworks + */ +class ReadNetworkCommissioningMaxNetworks : public ReadAttribute { public: - SubscribeAttributeLocalizationConfigurationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeLocalizationConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadNetworkCommissioningMaxNetworks() : ReadAttribute("max-networks") {} + + ~ReadNetworkCommissioningMaxNetworks() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxNetworksWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.MaxNetworks response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning MaxNetworks read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningMaxNetworks + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningMaxNetworks() + : SubscribeAttribute("max-networks") {} + + ~SubscribeAttributeNetworkCommissioningMaxNetworks() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxNetworksWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.MaxNetworks response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute Networks */ -class ReadLocalizationConfigurationAcceptedCommandList : public ReadAttribute { +class ReadNetworkCommissioningNetworks : public ReadAttribute { public: - ReadLocalizationConfigurationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadLocalizationConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadNetworkCommissioningNetworks() : ReadAttribute("networks") {} + + ~ReadNetworkCommissioningNetworks() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNetworksWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.Networks response %@", [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning Networks read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningNetworks + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningNetworks() + : SubscribeAttribute("networks") {} + + ~SubscribeAttributeNetworkCommissioningNetworks() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNetworksWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.Networks response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeLocalizationConfigurationAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute ScanMaxTimeSeconds + */ +class ReadNetworkCommissioningScanMaxTimeSeconds : public ReadAttribute { public: - SubscribeAttributeLocalizationConfigurationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeLocalizationConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadNetworkCommissioningScanMaxTimeSeconds() + : ReadAttribute("scan-max-time-seconds") {} + + ~ReadNetworkCommissioningScanMaxTimeSeconds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeScanMaxTimeSecondsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning ScanMaxTimeSeconds read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() + : SubscribeAttribute("scan-max-time-seconds") {} + + ~SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeScanMaxTimeSecondsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute ConnectMaxTimeSeconds */ -class ReadLocalizationConfigurationAttributeList : public ReadAttribute { +class ReadNetworkCommissioningConnectMaxTimeSeconds : public ReadAttribute { public: - ReadLocalizationConfigurationAttributeList() - : ReadAttribute("attribute-list") - { - } + ReadNetworkCommissioningConnectMaxTimeSeconds() + : ReadAttribute("connect-max-time-seconds") {} + + ~ReadNetworkCommissioningConnectMaxTimeSeconds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeConnectMaxTimeSecondsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning ConnectMaxTimeSeconds read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() + : SubscribeAttribute("connect-max-time-seconds") {} + + ~SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeConnectMaxTimeSecondsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadLocalizationConfigurationAttributeList() {} +/* + * Attribute InterfaceEnabled + */ +class ReadNetworkCommissioningInterfaceEnabled : public ReadAttribute { +public: + ReadNetworkCommissioningInterfaceEnabled() + : ReadAttribute("interface-enabled") {} + + ~ReadNetworkCommissioningInterfaceEnabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInterfaceEnabledWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning InterfaceEnabled read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteNetworkCommissioningInterfaceEnabled : public WriteAttribute { +public: + WriteNetworkCommissioningInterfaceEnabled() + : WriteAttribute("interface-enabled") { + AddArgument("attr-name", "interface-enabled"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteNetworkCommissioningInterfaceEnabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeInterfaceEnabledWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "NetworkCommissioning " + "InterfaceEnabled write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeLocalizationConfigurationAttributeList : public SubscribeAttribute { +class SubscribeAttributeNetworkCommissioningInterfaceEnabled + : public SubscribeAttribute { public: - SubscribeAttributeLocalizationConfigurationAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeNetworkCommissioningInterfaceEnabled() + : SubscribeAttribute("interface-enabled") {} - ~SubscribeAttributeLocalizationConfigurationAttributeList() {} + ~SubscribeAttributeNetworkCommissioningInterfaceEnabled() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInterfaceEnabledWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute LastNetworkingStatus */ -class ReadLocalizationConfigurationFeatureMap : public ReadAttribute { +class ReadNetworkCommissioningLastNetworkingStatus : public ReadAttribute { public: - ReadLocalizationConfigurationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadLocalizationConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadNetworkCommissioningLastNetworkingStatus() + : ReadAttribute("last-networking-status") {} + + ~ReadNetworkCommissioningLastNetworkingStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLastNetworkingStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning LastNetworkingStatus read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningLastNetworkingStatus + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningLastNetworkingStatus() + : SubscribeAttribute("last-networking-status") {} + + ~SubscribeAttributeNetworkCommissioningLastNetworkingStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLastNetworkingStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeLocalizationConfigurationFeatureMap : public SubscribeAttribute { +/* + * Attribute LastNetworkID + */ +class ReadNetworkCommissioningLastNetworkID : public ReadAttribute { public: - SubscribeAttributeLocalizationConfigurationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeLocalizationConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadNetworkCommissioningLastNetworkID() : ReadAttribute("last-network-id") {} + + ~ReadNetworkCommissioningLastNetworkID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLastNetworkIDWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastNetworkID response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning LastNetworkID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningLastNetworkID + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningLastNetworkID() + : SubscribeAttribute("last-network-id") {} + + ~SubscribeAttributeNetworkCommissioningLastNetworkID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLastNetworkIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastNetworkID response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute LastConnectErrorValue */ -class ReadLocalizationConfigurationClusterRevision : public ReadAttribute { +class ReadNetworkCommissioningLastConnectErrorValue : public ReadAttribute { public: - ReadLocalizationConfigurationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadLocalizationConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ReadNetworkCommissioningLastConnectErrorValue() + : ReadAttribute("last-connect-error-value") {} + + ~ReadNetworkCommissioningLastConnectErrorValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLastConnectErrorValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning LastConnectErrorValue read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningLastConnectErrorValue + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningLastConnectErrorValue() + : SubscribeAttribute("last-connect-error-value") {} + + ~SubscribeAttributeNetworkCommissioningLastConnectErrorValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLastConnectErrorValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("LocalizationConfiguration ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadNetworkCommissioningGeneratedCommandList : public ReadAttribute { +public: + ReadNetworkCommissioningGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadNetworkCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeNetworkCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeLocalizationConfigurationClusterRevision : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadNetworkCommissioningAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeLocalizationConfigurationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadNetworkCommissioningAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadNetworkCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeNetworkCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeLocalizationConfigurationClusterRevision() {} +/* + * Attribute AttributeList + */ +class ReadNetworkCommissioningAttributeList : public ReadAttribute { +public: + ReadNetworkCommissioningAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadNetworkCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeNetworkCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002B) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LocalizationConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute FeatureMap + */ +class ReadNetworkCommissioningFeatureMap : public ReadAttribute { +public: + ReadNetworkCommissioningFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadNetworkCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeNetworkCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadNetworkCommissioningClusterRevision : public ReadAttribute { +public: + ReadNetworkCommissioningClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadNetworkCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("NetworkCommissioning ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeNetworkCommissioningClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeNetworkCommissioningClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeNetworkCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000031) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterNetworkCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"NetworkCommissioning.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster TimeFormatLocalization | 0x002C | +| Cluster DiagnosticLogs | 0x0032 | |------------------------------------------------------------------------------| | Commands: | | +| * RetrieveLogsRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * HourFormat | 0x0000 | -| * ActiveCalendarType | 0x0001 | -| * SupportedCalendarTypes | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -14741,1128 +24734,1711 @@ class SubscribeAttributeLocalizationConfigurationClusterRevision : public Subscr \*----------------------------------------------------------------------------*/ /* - * Attribute HourFormat + * Command RetrieveLogsRequest */ -class ReadTimeFormatLocalizationHourFormat : public ReadAttribute { +class DiagnosticLogsRetrieveLogsRequest : public ClusterCommand { public: - ReadTimeFormatLocalizationHourFormat() - : ReadAttribute("hour-format") - { + DiagnosticLogsRetrieveLogsRequest() + : ClusterCommand("retrieve-logs-request") { + AddArgument("Intent", 0, UINT8_MAX, &mRequest.intent); + AddArgument("RequestedProtocol", 0, UINT8_MAX, &mRequest.requestedProtocol); + AddArgument("TransferFileDesignator", &mRequest.transferFileDesignator); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000032) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDiagnosticLogsClusterRetrieveLogsRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.intent = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.intent)]; + params.requestedProtocol = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.requestedProtocol)]; + params.transferFileDesignator = + [NSData dataWithBytes:mRequest.transferFileDesignator.data() + length:mRequest.transferFileDesignator.size()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + retrieveLogsRequestWithParams:params + completion:^( + MTRDiagnosticLogsClusterRetrieveLogsResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadTimeFormatLocalizationHourFormat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHourFormatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.HourFormat response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization HourFormat read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type + mRequest; }; -class WriteTimeFormatLocalizationHourFormat : public WriteAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadDiagnosticLogsGeneratedCommandList : public ReadAttribute { public: - WriteTimeFormatLocalizationHourFormat() - : WriteAttribute("hour-format") - { - AddArgument("attr-name", "hour-format"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteTimeFormatLocalizationHourFormat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeHourFormatWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("TimeFormatLocalization HourFormat write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; + ReadDiagnosticLogsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadDiagnosticLogsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("DiagnosticLogs GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDiagnosticLogsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDiagnosticLogsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeDiagnosticLogsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationHourFormat : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadDiagnosticLogsAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeTimeFormatLocalizationHourFormat() - : SubscribeAttribute("hour-format") - { - } - - ~SubscribeAttributeTimeFormatLocalizationHourFormat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeHourFormatWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.HourFormat response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadDiagnosticLogsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadDiagnosticLogsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("DiagnosticLogs AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDiagnosticLogsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDiagnosticLogsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeDiagnosticLogsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveCalendarType + * Attribute AttributeList */ -class ReadTimeFormatLocalizationActiveCalendarType : public ReadAttribute { +class ReadDiagnosticLogsAttributeList : public ReadAttribute { public: - ReadTimeFormatLocalizationActiveCalendarType() - : ReadAttribute("active-calendar-type") - { - } - - ~ReadTimeFormatLocalizationActiveCalendarType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveCalendarTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization ActiveCalendarType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDiagnosticLogsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadDiagnosticLogsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("DiagnosticLogs AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDiagnosticLogsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeDiagnosticLogsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeDiagnosticLogsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteTimeFormatLocalizationActiveCalendarType : public WriteAttribute { +/* + * Attribute FeatureMap + */ +class ReadDiagnosticLogsFeatureMap : public ReadAttribute { public: - WriteTimeFormatLocalizationActiveCalendarType() - : WriteAttribute("active-calendar-type") - { - AddArgument("attr-name", "active-calendar-type"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteTimeFormatLocalizationActiveCalendarType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeActiveCalendarTypeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("TimeFormatLocalization ActiveCalendarType write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; + ReadDiagnosticLogsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadDiagnosticLogsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("DiagnosticLogs FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationActiveCalendarType : public SubscribeAttribute { +class SubscribeAttributeDiagnosticLogsFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeTimeFormatLocalizationActiveCalendarType() - : SubscribeAttribute("active-calendar-type") - { - } + SubscribeAttributeDiagnosticLogsFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeTimeFormatLocalizationActiveCalendarType() {} + ~SubscribeAttributeDiagnosticLogsFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveCalendarTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SupportedCalendarTypes + * Attribute ClusterRevision */ -class ReadTimeFormatLocalizationSupportedCalendarTypes : public ReadAttribute { +class ReadDiagnosticLogsClusterRevision : public ReadAttribute { public: - ReadTimeFormatLocalizationSupportedCalendarTypes() - : ReadAttribute("supported-calendar-types") - { - } - - ~ReadTimeFormatLocalizationSupportedCalendarTypes() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportedCalendarTypesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization SupportedCalendarTypes read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDiagnosticLogsClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadDiagnosticLogsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("DiagnosticLogs ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDiagnosticLogsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeDiagnosticLogsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeDiagnosticLogsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000032) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DiagnosticLogs.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes : public SubscribeAttribute { +/*----------------------------------------------------------------------------*\ +| Cluster GeneralDiagnostics | 0x0033 | +|------------------------------------------------------------------------------| +| Commands: | | +| * TestEventTrigger | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NetworkInterfaces | 0x0000 | +| * RebootCount | 0x0001 | +| * UpTime | 0x0002 | +| * TotalOperationalHours | 0x0003 | +| * BootReasons | 0x0004 | +| * ActiveHardwareFaults | 0x0005 | +| * ActiveRadioFaults | 0x0006 | +| * ActiveNetworkFaults | 0x0007 | +| * TestEventTriggersEnabled | 0x0008 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * HardwareFaultChange | 0x0000 | +| * RadioFaultChange | 0x0001 | +| * NetworkFaultChange | 0x0002 | +| * BootReason | 0x0003 | +\*----------------------------------------------------------------------------*/ + +/* + * Command TestEventTrigger + */ +class GeneralDiagnosticsTestEventTrigger : public ClusterCommand { public: - SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() - : SubscribeAttribute("supported-calendar-types") - { + GeneralDiagnosticsTestEventTrigger() : ClusterCommand("test-event-trigger") { + AddArgument("EnableKey", &mRequest.enableKey); + AddArgument("EventTrigger", 0, UINT64_MAX, &mRequest.eventTrigger); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000033) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.enableKey = [NSData dataWithBytes:mRequest.enableKey.data() + length:mRequest.enableKey.size()]; + params.eventTrigger = + [NSNumber numberWithUnsignedLongLong:mRequest.eventTrigger]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testEventTriggerWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSupportedCalendarTypesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type + mRequest; }; /* - * Attribute GeneratedCommandList + * Attribute NetworkInterfaces */ -class ReadTimeFormatLocalizationGeneratedCommandList : public ReadAttribute { +class ReadGeneralDiagnosticsNetworkInterfaces : public ReadAttribute { public: - ReadTimeFormatLocalizationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadTimeFormatLocalizationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsNetworkInterfaces() + : ReadAttribute("network-interfaces") {} + + ~ReadGeneralDiagnosticsNetworkInterfaces() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNetworkInterfacesWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics NetworkInterfaces read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsNetworkInterfaces + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() + : SubscribeAttribute("network-interfaces") {} + + ~SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNetworkInterfacesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationGeneratedCommandList : public SubscribeAttribute { +/* + * Attribute RebootCount + */ +class ReadGeneralDiagnosticsRebootCount : public ReadAttribute { public: - SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsRebootCount() : ReadAttribute("reboot-count") {} + + ~ReadGeneralDiagnosticsRebootCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRebootCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics RebootCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsRebootCount + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsRebootCount() + : SubscribeAttribute("reboot-count") {} + + ~SubscribeAttributeGeneralDiagnosticsRebootCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRebootCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.RebootCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute UpTime */ -class ReadTimeFormatLocalizationAcceptedCommandList : public ReadAttribute { +class ReadGeneralDiagnosticsUpTime : public ReadAttribute { public: - ReadTimeFormatLocalizationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadTimeFormatLocalizationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsUpTime() : ReadAttribute("up-time") {} + + ~ReadGeneralDiagnosticsUpTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUpTimeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics UpTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeGeneralDiagnosticsUpTime : public SubscribeAttribute { public: - SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeGeneralDiagnosticsUpTime() + : SubscribeAttribute("up-time") {} - ~SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() {} + ~SubscribeAttributeGeneralDiagnosticsUpTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUpTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute TotalOperationalHours */ -class ReadTimeFormatLocalizationAttributeList : public ReadAttribute { +class ReadGeneralDiagnosticsTotalOperationalHours : public ReadAttribute { public: - ReadTimeFormatLocalizationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadTimeFormatLocalizationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsTotalOperationalHours() + : ReadAttribute("total-operational-hours") {} + + ~ReadGeneralDiagnosticsTotalOperationalHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTotalOperationalHoursWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics TotalOperationalHours read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsTotalOperationalHours + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() + : SubscribeAttribute("total-operational-hours") {} + + ~SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTotalOperationalHoursWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationAttributeList : public SubscribeAttribute { +/* + * Attribute BootReasons + */ +class ReadGeneralDiagnosticsBootReasons : public ReadAttribute { public: - SubscribeAttributeTimeFormatLocalizationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeTimeFormatLocalizationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsBootReasons() : ReadAttribute("boot-reasons") {} + + ~ReadGeneralDiagnosticsBootReasons() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBootReasonsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.BootReasons response %@", [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics BootReasons read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsBootReasons + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsBootReasons() + : SubscribeAttribute("boot-reasons") {} + + ~SubscribeAttributeGeneralDiagnosticsBootReasons() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBootReasonsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.BootReasons response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ActiveHardwareFaults */ -class ReadTimeFormatLocalizationFeatureMap : public ReadAttribute { +class ReadGeneralDiagnosticsActiveHardwareFaults : public ReadAttribute { public: - ReadTimeFormatLocalizationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadTimeFormatLocalizationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsActiveHardwareFaults() + : ReadAttribute("active-hardware-faults") {} + + ~ReadGeneralDiagnosticsActiveHardwareFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveHardwareFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics ActiveHardwareFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() + : SubscribeAttribute("active-hardware-faults") {} + + ~SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveHardwareFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationFeatureMap : public SubscribeAttribute { +/* + * Attribute ActiveRadioFaults + */ +class ReadGeneralDiagnosticsActiveRadioFaults : public ReadAttribute { public: - SubscribeAttributeTimeFormatLocalizationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeTimeFormatLocalizationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsActiveRadioFaults() + : ReadAttribute("active-radio-faults") {} + + ~ReadGeneralDiagnosticsActiveRadioFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveRadioFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics ActiveRadioFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsActiveRadioFaults + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() + : SubscribeAttribute("active-radio-faults") {} + + ~SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveRadioFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute ActiveNetworkFaults */ -class ReadTimeFormatLocalizationClusterRevision : public ReadAttribute { +class ReadGeneralDiagnosticsActiveNetworkFaults : public ReadAttribute { public: - ReadTimeFormatLocalizationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadTimeFormatLocalizationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("TimeFormatLocalization ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsActiveNetworkFaults() + : ReadAttribute("active-network-faults") {} + + ~ReadGeneralDiagnosticsActiveNetworkFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveNetworkFaultsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics ActiveNetworkFaults read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() + : SubscribeAttribute("active-network-faults") {} + + ~SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveNetworkFaultsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeTimeFormatLocalizationClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeTimeFormatLocalizationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeTimeFormatLocalizationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002C) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TimeFormatLocalization.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster UnitLocalization | 0x002D | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * TemperatureUnit | 0x0000 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Attribute TemperatureUnit + * Attribute TestEventTriggersEnabled */ -class ReadUnitLocalizationTemperatureUnit : public ReadAttribute { -public: - ReadUnitLocalizationTemperatureUnit() - : ReadAttribute("temperature-unit") - { - } - - ~ReadUnitLocalizationTemperatureUnit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTemperatureUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.TemperatureUnit response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization TemperatureUnit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteUnitLocalizationTemperatureUnit : public WriteAttribute { -public: - WriteUnitLocalizationTemperatureUnit() - : WriteAttribute("temperature-unit") - { - AddArgument("attr-name", "temperature-unit"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitLocalizationTemperatureUnit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeTemperatureUnitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitLocalization TemperatureUnit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeUnitLocalizationTemperatureUnit : public SubscribeAttribute { +class ReadGeneralDiagnosticsTestEventTriggersEnabled : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationTemperatureUnit() - : SubscribeAttribute("temperature-unit") - { - } - - ~SubscribeAttributeUnitLocalizationTemperatureUnit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTemperatureUnitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.TemperatureUnit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsTestEventTriggersEnabled() + : ReadAttribute("test-event-triggers-enabled") {} + + ~ReadGeneralDiagnosticsTestEventTriggersEnabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTestEventTriggersEnabledWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics TestEventTriggersEnabled read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() + : SubscribeAttribute("test-event-triggers-enabled") {} + + ~SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTestEventTriggersEnabledWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute GeneratedCommandList */ -class ReadUnitLocalizationGeneratedCommandList : public ReadAttribute { -public: - ReadUnitLocalizationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadUnitLocalizationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitLocalizationGeneratedCommandList : public SubscribeAttribute { +class ReadGeneralDiagnosticsGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeUnitLocalizationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadGeneralDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AcceptedCommandList */ -class ReadUnitLocalizationAcceptedCommandList : public ReadAttribute { -public: - ReadUnitLocalizationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadUnitLocalizationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitLocalizationAcceptedCommandList : public SubscribeAttribute { +class ReadGeneralDiagnosticsAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeUnitLocalizationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadGeneralDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadUnitLocalizationAttributeList : public ReadAttribute { -public: - ReadUnitLocalizationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadUnitLocalizationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitLocalizationAttributeList : public SubscribeAttribute { +class ReadGeneralDiagnosticsAttributeList : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeUnitLocalizationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadGeneralDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeGeneralDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadUnitLocalizationFeatureMap : public ReadAttribute { -public: - ReadUnitLocalizationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadUnitLocalizationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitLocalizationFeatureMap : public SubscribeAttribute { +class ReadGeneralDiagnosticsFeatureMap : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeUnitLocalizationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadGeneralDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeGeneralDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadUnitLocalizationClusterRevision : public ReadAttribute { -public: - ReadUnitLocalizationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadUnitLocalizationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("UnitLocalization ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitLocalizationClusterRevision : public SubscribeAttribute { +class ReadGeneralDiagnosticsClusterRevision : public ReadAttribute { public: - SubscribeAttributeUnitLocalizationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeUnitLocalizationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002D) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitLocalization.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGeneralDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadGeneralDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("GeneralDiagnostics ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGeneralDiagnosticsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeGeneralDiagnosticsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeGeneralDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000033) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GeneralDiagnostics.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster PowerSourceConfiguration | 0x002E | +| Cluster SoftwareDiagnostics | 0x0034 | |------------------------------------------------------------------------------| | Commands: | | +| * ResetWatermarks | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Sources | 0x0000 | +| * ThreadMetrics | 0x0000 | +| * CurrentHeapFree | 0x0001 | +| * CurrentHeapUsed | 0x0002 | +| * CurrentHeapHighWatermark | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -15870,465 +26446,865 @@ class SubscribeAttributeUnitLocalizationClusterRevision : public SubscribeAttrib | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * SoftwareFault | 0x0000 | \*----------------------------------------------------------------------------*/ /* - * Attribute Sources + * Command ResetWatermarks */ -class ReadPowerSourceConfigurationSources : public ReadAttribute { +class SoftwareDiagnosticsResetWatermarks : public ClusterCommand { public: - ReadPowerSourceConfigurationSources() - : ReadAttribute("sources") - { + SoftwareDiagnosticsResetWatermarks() : ClusterCommand("reset-watermarks") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000034) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSoftwareDiagnosticsClusterResetWatermarksParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster resetWatermarksWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadPowerSourceConfigurationSources() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSourcesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.Sources response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration Sources read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributePowerSourceConfigurationSources : public SubscribeAttribute { +/* + * Attribute ThreadMetrics + */ +class ReadSoftwareDiagnosticsThreadMetrics : public ReadAttribute { public: - SubscribeAttributePowerSourceConfigurationSources() - : SubscribeAttribute("sources") - { - } - - ~SubscribeAttributePowerSourceConfigurationSources() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSourcesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.Sources response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadSoftwareDiagnosticsThreadMetrics() : ReadAttribute("thread-metrics") {} + + ~ReadSoftwareDiagnosticsThreadMetrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeThreadMetricsWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics ThreadMetrics read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsThreadMetrics + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsThreadMetrics() + : SubscribeAttribute("thread-metrics") {} + + ~SubscribeAttributeSoftwareDiagnosticsThreadMetrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeThreadMetricsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute CurrentHeapFree */ -class ReadPowerSourceConfigurationGeneratedCommandList : public ReadAttribute { +class ReadSoftwareDiagnosticsCurrentHeapFree : public ReadAttribute { public: - ReadPowerSourceConfigurationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadPowerSourceConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadSoftwareDiagnosticsCurrentHeapFree() + : ReadAttribute("current-heap-free") {} + + ~ReadSoftwareDiagnosticsCurrentHeapFree() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentHeapFreeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics CurrentHeapFree read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() + : SubscribeAttribute("current-heap-free") {} + + ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentHeapFreeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceConfigurationGeneratedCommandList : public SubscribeAttribute { +/* + * Attribute CurrentHeapUsed + */ +class ReadSoftwareDiagnosticsCurrentHeapUsed : public ReadAttribute { public: - SubscribeAttributePowerSourceConfigurationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributePowerSourceConfigurationGeneratedCommandList() {} + ReadSoftwareDiagnosticsCurrentHeapUsed() + : ReadAttribute("current-heap-used") {} + + ~ReadSoftwareDiagnosticsCurrentHeapUsed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentHeapUsedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics CurrentHeapUsed read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() + : SubscribeAttribute("current-heap-used") {} + + ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentHeapUsedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute CurrentHeapHighWatermark + */ +class ReadSoftwareDiagnosticsCurrentHeapHighWatermark : public ReadAttribute { +public: + ReadSoftwareDiagnosticsCurrentHeapHighWatermark() + : ReadAttribute("current-heap-high-watermark") {} + + ~ReadSoftwareDiagnosticsCurrentHeapHighWatermark() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentHeapHighWatermarkWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics CurrentHeapHighWatermark read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() + : SubscribeAttribute("current-heap-high-watermark") {} + + ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentHeapHighWatermarkWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadSoftwareDiagnosticsGeneratedCommandList : public ReadAttribute { +public: + ReadSoftwareDiagnosticsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadSoftwareDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AcceptedCommandList */ -class ReadPowerSourceConfigurationAcceptedCommandList : public ReadAttribute { +class ReadSoftwareDiagnosticsAcceptedCommandList : public ReadAttribute { public: - ReadPowerSourceConfigurationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadPowerSourceConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePowerSourceConfigurationAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePowerSourceConfigurationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributePowerSourceConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; + ReadSoftwareDiagnosticsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadSoftwareDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; /* * Attribute AttributeList */ -class ReadPowerSourceConfigurationAttributeList : public ReadAttribute { -public: - ReadPowerSourceConfigurationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadPowerSourceConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePowerSourceConfigurationAttributeList : public SubscribeAttribute { +class ReadSoftwareDiagnosticsAttributeList : public ReadAttribute { public: - SubscribeAttributePowerSourceConfigurationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributePowerSourceConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadSoftwareDiagnosticsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadSoftwareDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeSoftwareDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadPowerSourceConfigurationFeatureMap : public ReadAttribute { -public: - ReadPowerSourceConfigurationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadPowerSourceConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePowerSourceConfigurationFeatureMap : public SubscribeAttribute { +class ReadSoftwareDiagnosticsFeatureMap : public ReadAttribute { public: - SubscribeAttributePowerSourceConfigurationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributePowerSourceConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadSoftwareDiagnosticsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadSoftwareDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeSoftwareDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadPowerSourceConfigurationClusterRevision : public ReadAttribute { -public: - ReadPowerSourceConfigurationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadPowerSourceConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("PowerSourceConfiguration ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePowerSourceConfigurationClusterRevision : public SubscribeAttribute { +class ReadSoftwareDiagnosticsClusterRevision : public ReadAttribute { public: - SubscribeAttributePowerSourceConfigurationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributePowerSourceConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002E) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadSoftwareDiagnosticsClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadSoftwareDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("SoftwareDiagnostics ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSoftwareDiagnosticsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeSoftwareDiagnosticsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeSoftwareDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000034) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster PowerSource | 0x002F | +| Cluster ThreadNetworkDiagnostics | 0x0035 | |------------------------------------------------------------------------------| | Commands: | | +| * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Status | 0x0000 | -| * Order | 0x0001 | -| * Description | 0x0002 | -| * WiredAssessedInputVoltage | 0x0003 | -| * WiredAssessedInputFrequency | 0x0004 | -| * WiredCurrentType | 0x0005 | -| * WiredAssessedCurrent | 0x0006 | -| * WiredNominalVoltage | 0x0007 | -| * WiredMaximumCurrent | 0x0008 | -| * WiredPresent | 0x0009 | -| * ActiveWiredFaults | 0x000A | -| * BatVoltage | 0x000B | -| * BatPercentRemaining | 0x000C | -| * BatTimeRemaining | 0x000D | -| * BatChargeLevel | 0x000E | -| * BatReplacementNeeded | 0x000F | -| * BatReplaceability | 0x0010 | -| * BatPresent | 0x0011 | -| * ActiveBatFaults | 0x0012 | -| * BatReplacementDescription | 0x0013 | -| * BatCommonDesignation | 0x0014 | -| * BatANSIDesignation | 0x0015 | -| * BatIECDesignation | 0x0016 | -| * BatApprovedChemistry | 0x0017 | -| * BatCapacity | 0x0018 | -| * BatQuantity | 0x0019 | -| * BatChargeState | 0x001A | -| * BatTimeToFullCharge | 0x001B | -| * BatFunctionalWhileCharging | 0x001C | -| * BatChargingCurrent | 0x001D | -| * ActiveBatChargeFaults | 0x001E | +| * Channel | 0x0000 | +| * RoutingRole | 0x0001 | +| * NetworkName | 0x0002 | +| * PanId | 0x0003 | +| * ExtendedPanId | 0x0004 | +| * MeshLocalPrefix | 0x0005 | +| * OverrunCount | 0x0006 | +| * NeighborTableList | 0x0007 | +| * RouteTableList | 0x0008 | +| * PartitionId | 0x0009 | +| * Weighting | 0x000A | +| * DataVersion | 0x000B | +| * StableDataVersion | 0x000C | +| * LeaderRouterId | 0x000D | +| * DetachedRoleCount | 0x000E | +| * ChildRoleCount | 0x000F | +| * RouterRoleCount | 0x0010 | +| * LeaderRoleCount | 0x0011 | +| * AttachAttemptCount | 0x0012 | +| * PartitionIdChangeCount | 0x0013 | +| * BetterPartitionAttachAttemptCount | 0x0014 | +| * ParentChangeCount | 0x0015 | +| * TxTotalCount | 0x0016 | +| * TxUnicastCount | 0x0017 | +| * TxBroadcastCount | 0x0018 | +| * TxAckRequestedCount | 0x0019 | +| * TxAckedCount | 0x001A | +| * TxNoAckRequestedCount | 0x001B | +| * TxDataCount | 0x001C | +| * TxDataPollCount | 0x001D | +| * TxBeaconCount | 0x001E | +| * TxBeaconRequestCount | 0x001F | +| * TxOtherCount | 0x0020 | +| * TxRetryCount | 0x0021 | +| * TxDirectMaxRetryExpiryCount | 0x0022 | +| * TxIndirectMaxRetryExpiryCount | 0x0023 | +| * TxErrCcaCount | 0x0024 | +| * TxErrAbortCount | 0x0025 | +| * TxErrBusyChannelCount | 0x0026 | +| * RxTotalCount | 0x0027 | +| * RxUnicastCount | 0x0028 | +| * RxBroadcastCount | 0x0029 | +| * RxDataCount | 0x002A | +| * RxDataPollCount | 0x002B | +| * RxBeaconCount | 0x002C | +| * RxBeaconRequestCount | 0x002D | +| * RxOtherCount | 0x002E | +| * RxAddressFilteredCount | 0x002F | +| * RxDestAddrFilteredCount | 0x0030 | +| * RxDuplicatedCount | 0x0031 | +| * RxErrNoFrameCount | 0x0032 | +| * RxErrUnknownNeighborCount | 0x0033 | +| * RxErrInvalidSrcAddrCount | 0x0034 | +| * RxErrSecCount | 0x0035 | +| * RxErrFcsCount | 0x0036 | +| * RxErrOtherCount | 0x0037 | +| * ActiveTimestamp | 0x0038 | +| * PendingTimestamp | 0x0039 | +| * Delay | 0x003A | +| * SecurityPolicy | 0x003B | +| * ChannelPage0Mask | 0x003C | +| * OperationalDatasetComponents | 0x003D | +| * ActiveNetworkFaultsList | 0x003E | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -16336,2542 +27312,7267 @@ class SubscribeAttributePowerSourceConfigurationClusterRevision : public Subscri | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * ConnectionStatus | 0x0000 | +| * NetworkFaultChange | 0x0001 | \*----------------------------------------------------------------------------*/ /* - * Attribute Status + * Command ResetCounts */ -class ReadPowerSourceStatus : public ReadAttribute { +class ThreadNetworkDiagnosticsResetCounts : public ClusterCommand { public: - ReadPowerSourceStatus() - : ReadAttribute("status") - { + ThreadNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000035) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRThreadNetworkDiagnosticsClusterResetCountsParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster resetCountsWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadPowerSourceStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Status response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource Status read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributePowerSourceStatus : public SubscribeAttribute { +/* + * Attribute Channel + */ +class ReadThreadNetworkDiagnosticsChannel : public ReadAttribute { public: - SubscribeAttributePowerSourceStatus() - : SubscribeAttribute("status") - { - } - - ~SubscribeAttributePowerSourceStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Status response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsChannel() : ReadAttribute("channel") {} + + ~ReadThreadNetworkDiagnosticsChannel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeChannelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Channel response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics Channel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsChannel + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsChannel() + : SubscribeAttribute("channel") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsChannel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeChannelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Channel response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Order + * Attribute RoutingRole */ -class ReadPowerSourceOrder : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRoutingRole : public ReadAttribute { public: - ReadPowerSourceOrder() - : ReadAttribute("order") - { - } - - ~ReadPowerSourceOrder() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOrderWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Order response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource Order read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRoutingRole() : ReadAttribute("routing-role") {} + + ~ReadThreadNetworkDiagnosticsRoutingRole() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRoutingRoleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RoutingRole read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRoutingRole + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() + : SubscribeAttribute("routing-role") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRoutingRoleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceOrder : public SubscribeAttribute { +/* + * Attribute NetworkName + */ +class ReadThreadNetworkDiagnosticsNetworkName : public ReadAttribute { public: - SubscribeAttributePowerSourceOrder() - : SubscribeAttribute("order") - { - } - - ~SubscribeAttributePowerSourceOrder() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOrderWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Order response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsNetworkName() : ReadAttribute("network-name") {} + + ~ReadThreadNetworkDiagnosticsNetworkName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNetworkNameWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics NetworkName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsNetworkName + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsNetworkName() + : SubscribeAttribute("network-name") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsNetworkName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNetworkNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Description + * Attribute PanId */ -class ReadPowerSourceDescription : public ReadAttribute { +class ReadThreadNetworkDiagnosticsPanId : public ReadAttribute { public: - ReadPowerSourceDescription() - : ReadAttribute("description") - { - } - - ~ReadPowerSourceDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Description response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource Description read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsPanId() : ReadAttribute("pan-id") {} + + ~ReadThreadNetworkDiagnosticsPanId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePanIdWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics PanId read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsPanId + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsPanId() + : SubscribeAttribute("pan-id") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsPanId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePanIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PanId response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceDescription : public SubscribeAttribute { -public: - SubscribeAttributePowerSourceDescription() - : SubscribeAttribute("description") - { - } - - ~SubscribeAttributePowerSourceDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDescriptionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.Description response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute ExtendedPanId + */ +class ReadThreadNetworkDiagnosticsExtendedPanId : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsExtendedPanId() + : ReadAttribute("extended-pan-id") {} + + ~ReadThreadNetworkDiagnosticsExtendedPanId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeExtendedPanIdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ExtendedPanId read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() + : SubscribeAttribute("extended-pan-id") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExtendedPanIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredAssessedInputVoltage + * Attribute MeshLocalPrefix */ -class ReadPowerSourceWiredAssessedInputVoltage : public ReadAttribute { +class ReadThreadNetworkDiagnosticsMeshLocalPrefix : public ReadAttribute { public: - ReadPowerSourceWiredAssessedInputVoltage() - : ReadAttribute("wired-assessed-input-voltage") - { - } - - ~ReadPowerSourceWiredAssessedInputVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredAssessedInputVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredAssessedInputVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsMeshLocalPrefix() + : ReadAttribute("mesh-local-prefix") {} + + ~ReadThreadNetworkDiagnosticsMeshLocalPrefix() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeshLocalPrefixWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics MeshLocalPrefix read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() + : SubscribeAttribute("mesh-local-prefix") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeshLocalPrefixWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredAssessedInputVoltage : public SubscribeAttribute { +/* + * Attribute OverrunCount + */ +class ReadThreadNetworkDiagnosticsOverrunCount : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredAssessedInputVoltage() - : SubscribeAttribute("wired-assessed-input-voltage") - { - } - - ~SubscribeAttributePowerSourceWiredAssessedInputVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredAssessedInputVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsOverrunCount() : ReadAttribute("overrun-count") {} + + ~ReadThreadNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOverrunCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics OverrunCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsOverrunCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() + : SubscribeAttribute("overrun-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOverrunCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredAssessedInputFrequency + * Attribute NeighborTableList */ -class ReadPowerSourceWiredAssessedInputFrequency : public ReadAttribute { +class ReadThreadNetworkDiagnosticsNeighborTableList : public ReadAttribute { public: - ReadPowerSourceWiredAssessedInputFrequency() - : ReadAttribute("wired-assessed-input-frequency") - { - } - - ~ReadPowerSourceWiredAssessedInputFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredAssessedInputFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredAssessedInputFrequency read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsNeighborTableList() + : ReadAttribute("neighbor-table-list") {} + + ~ReadThreadNetworkDiagnosticsNeighborTableList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNeighborTableListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.NeighborTableList response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics NeighborTableList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList() + : SubscribeAttribute("neighbor-table-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNeighborTableListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.NeighborTableList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredAssessedInputFrequency : public SubscribeAttribute { +/* + * Attribute RouteTableList + */ +class ReadThreadNetworkDiagnosticsRouteTableList : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredAssessedInputFrequency() - : SubscribeAttribute("wired-assessed-input-frequency") - { - } - - ~SubscribeAttributePowerSourceWiredAssessedInputFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredAssessedInputFrequencyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRouteTableList() + : ReadAttribute("route-table-list") {} + + ~ReadThreadNetworkDiagnosticsRouteTableList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRouteTableListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RouteTableList response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RouteTableList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRouteTableList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRouteTableList() + : SubscribeAttribute("route-table-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRouteTableList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRouteTableListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RouteTableList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredCurrentType + * Attribute PartitionId */ -class ReadPowerSourceWiredCurrentType : public ReadAttribute { +class ReadThreadNetworkDiagnosticsPartitionId : public ReadAttribute { public: - ReadPowerSourceWiredCurrentType() - : ReadAttribute("wired-current-type") - { - } - - ~ReadPowerSourceWiredCurrentType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredCurrentTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredCurrentType response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredCurrentType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsPartitionId() : ReadAttribute("partition-id") {} + + ~ReadThreadNetworkDiagnosticsPartitionId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePartitionIdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics PartitionId read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsPartitionId + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsPartitionId() + : SubscribeAttribute("partition-id") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsPartitionId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePartitionIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredCurrentType : public SubscribeAttribute { +/* + * Attribute Weighting + */ +class ReadThreadNetworkDiagnosticsWeighting : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredCurrentType() - : SubscribeAttribute("wired-current-type") - { - } - - ~SubscribeAttributePowerSourceWiredCurrentType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredCurrentTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredCurrentType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsWeighting() : ReadAttribute("weighting") {} + + ~ReadThreadNetworkDiagnosticsWeighting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWeightingWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics Weighting read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsWeighting + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsWeighting() + : SubscribeAttribute("weighting") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsWeighting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWeightingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredAssessedCurrent + * Attribute DataVersion */ -class ReadPowerSourceWiredAssessedCurrent : public ReadAttribute { +class ReadThreadNetworkDiagnosticsDataVersion : public ReadAttribute { public: - ReadPowerSourceWiredAssessedCurrent() - : ReadAttribute("wired-assessed-current") - { - } - - ~ReadPowerSourceWiredAssessedCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredAssessedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedCurrent response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredAssessedCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsDataVersion() : ReadAttribute("data-version") {} + + ~ReadThreadNetworkDiagnosticsDataVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDataVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics DataVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsDataVersion + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsDataVersion() + : SubscribeAttribute("data-version") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsDataVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDataVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredAssessedCurrent : public SubscribeAttribute { +/* + * Attribute StableDataVersion + */ +class ReadThreadNetworkDiagnosticsStableDataVersion : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredAssessedCurrent() - : SubscribeAttribute("wired-assessed-current") - { - } - - ~SubscribeAttributePowerSourceWiredAssessedCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredAssessedCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredAssessedCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsStableDataVersion() + : ReadAttribute("stable-data-version") {} + + ~ReadThreadNetworkDiagnosticsStableDataVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStableDataVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics StableDataVersion read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() + : SubscribeAttribute("stable-data-version") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStableDataVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredNominalVoltage + * Attribute LeaderRouterId */ -class ReadPowerSourceWiredNominalVoltage : public ReadAttribute { +class ReadThreadNetworkDiagnosticsLeaderRouterId : public ReadAttribute { public: - ReadPowerSourceWiredNominalVoltage() - : ReadAttribute("wired-nominal-voltage") - { - } - - ~ReadPowerSourceWiredNominalVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredNominalVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredNominalVoltage response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredNominalVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsLeaderRouterId() + : ReadAttribute("leader-router-id") {} + + ~ReadThreadNetworkDiagnosticsLeaderRouterId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLeaderRouterIdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics LeaderRouterId read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() + : SubscribeAttribute("leader-router-id") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLeaderRouterIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredNominalVoltage : public SubscribeAttribute { +/* + * Attribute DetachedRoleCount + */ +class ReadThreadNetworkDiagnosticsDetachedRoleCount : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredNominalVoltage() - : SubscribeAttribute("wired-nominal-voltage") - { - } - - ~SubscribeAttributePowerSourceWiredNominalVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredNominalVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredNominalVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsDetachedRoleCount() + : ReadAttribute("detached-role-count") {} + + ~ReadThreadNetworkDiagnosticsDetachedRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDetachedRoleCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics DetachedRoleCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() + : SubscribeAttribute("detached-role-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDetachedRoleCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredMaximumCurrent + * Attribute ChildRoleCount */ -class ReadPowerSourceWiredMaximumCurrent : public ReadAttribute { +class ReadThreadNetworkDiagnosticsChildRoleCount : public ReadAttribute { public: - ReadPowerSourceWiredMaximumCurrent() - : ReadAttribute("wired-maximum-current") - { - } - - ~ReadPowerSourceWiredMaximumCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredMaximumCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredMaximumCurrent response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredMaximumCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsChildRoleCount() + : ReadAttribute("child-role-count") {} + + ~ReadThreadNetworkDiagnosticsChildRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeChildRoleCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ChildRoleCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() + : SubscribeAttribute("child-role-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeChildRoleCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredMaximumCurrent : public SubscribeAttribute { +/* + * Attribute RouterRoleCount + */ +class ReadThreadNetworkDiagnosticsRouterRoleCount : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredMaximumCurrent() - : SubscribeAttribute("wired-maximum-current") - { - } - - ~SubscribeAttributePowerSourceWiredMaximumCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredMaximumCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredMaximumCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRouterRoleCount() + : ReadAttribute("router-role-count") {} + + ~ReadThreadNetworkDiagnosticsRouterRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRouterRoleCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RouterRoleCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() + : SubscribeAttribute("router-role-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRouterRoleCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiredPresent + * Attribute LeaderRoleCount */ -class ReadPowerSourceWiredPresent : public ReadAttribute { +class ReadThreadNetworkDiagnosticsLeaderRoleCount : public ReadAttribute { public: - ReadPowerSourceWiredPresent() - : ReadAttribute("wired-present") - { - } - - ~ReadPowerSourceWiredPresent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiredPresentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredPresent response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource WiredPresent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsLeaderRoleCount() + : ReadAttribute("leader-role-count") {} + + ~ReadThreadNetworkDiagnosticsLeaderRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLeaderRoleCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics LeaderRoleCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() + : SubscribeAttribute("leader-role-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLeaderRoleCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceWiredPresent : public SubscribeAttribute { +/* + * Attribute AttachAttemptCount + */ +class ReadThreadNetworkDiagnosticsAttachAttemptCount : public ReadAttribute { public: - SubscribeAttributePowerSourceWiredPresent() - : SubscribeAttribute("wired-present") - { - } - - ~SubscribeAttributePowerSourceWiredPresent() {} + ReadThreadNetworkDiagnosticsAttachAttemptCount() + : ReadAttribute("attach-attempt-count") {} + + ~ReadThreadNetworkDiagnosticsAttachAttemptCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttachAttemptCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics AttachAttemptCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() + : SubscribeAttribute("attach-attempt-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttachAttemptCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiredPresentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.WiredPresent response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute PartitionIdChangeCount + */ +class ReadThreadNetworkDiagnosticsPartitionIdChangeCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsPartitionIdChangeCount() + : ReadAttribute("partition-id-change-count") {} + + ~ReadThreadNetworkDiagnosticsPartitionIdChangeCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePartitionIdChangeCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics PartitionIdChangeCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() + : SubscribeAttribute("partition-id-change-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePartitionIdChangeCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute BetterPartitionAttachAttemptCount + */ +class ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() + : ReadAttribute("better-partition-attach-attempt-count") {} + + ~ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBetterPartitionAttachAttemptCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics BetterPartitionAttachAttemptCount " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class + SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() + : SubscribeAttribute("better-partition-attach-attempt-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeBetterPartitionAttachAttemptCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveWiredFaults + * Attribute ParentChangeCount */ -class ReadPowerSourceActiveWiredFaults : public ReadAttribute { +class ReadThreadNetworkDiagnosticsParentChangeCount : public ReadAttribute { public: - ReadPowerSourceActiveWiredFaults() - : ReadAttribute("active-wired-faults") - { - } - - ~ReadPowerSourceActiveWiredFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveWiredFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveWiredFaults response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource ActiveWiredFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsParentChangeCount() + : ReadAttribute("parent-change-count") {} + + ~ReadThreadNetworkDiagnosticsParentChangeCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeParentChangeCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ParentChangeCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() + : SubscribeAttribute("parent-change-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeParentChangeCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceActiveWiredFaults : public SubscribeAttribute { +/* + * Attribute TxTotalCount + */ +class ReadThreadNetworkDiagnosticsTxTotalCount : public ReadAttribute { public: - SubscribeAttributePowerSourceActiveWiredFaults() - : SubscribeAttribute("active-wired-faults") - { - } - - ~SubscribeAttributePowerSourceActiveWiredFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveWiredFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveWiredFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxTotalCount() + : ReadAttribute("tx-total-count") {} + + ~ReadThreadNetworkDiagnosticsTxTotalCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxTotalCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxTotalCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() + : SubscribeAttribute("tx-total-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxTotalCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatVoltage + * Attribute TxUnicastCount */ -class ReadPowerSourceBatVoltage : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxUnicastCount : public ReadAttribute { public: - ReadPowerSourceBatVoltage() - : ReadAttribute("bat-voltage") - { - } - - ~ReadPowerSourceBatVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatVoltage response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxUnicastCount() + : ReadAttribute("tx-unicast-count") {} + + ~ReadThreadNetworkDiagnosticsTxUnicastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxUnicastCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxUnicastCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() + : SubscribeAttribute("tx-unicast-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxUnicastCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatVoltage : public SubscribeAttribute { +/* + * Attribute TxBroadcastCount + */ +class ReadThreadNetworkDiagnosticsTxBroadcastCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatVoltage() - : SubscribeAttribute("bat-voltage") - { - } - - ~SubscribeAttributePowerSourceBatVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxBroadcastCount() + : ReadAttribute("tx-broadcast-count") {} + + ~ReadThreadNetworkDiagnosticsTxBroadcastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxBroadcastCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxBroadcastCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() + : SubscribeAttribute("tx-broadcast-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxBroadcastCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatPercentRemaining + * Attribute TxAckRequestedCount */ -class ReadPowerSourceBatPercentRemaining : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxAckRequestedCount : public ReadAttribute { public: - ReadPowerSourceBatPercentRemaining() - : ReadAttribute("bat-percent-remaining") - { - } - - ~ReadPowerSourceBatPercentRemaining() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000C) on endpoint %u", endpointId); + ReadThreadNetworkDiagnosticsTxAckRequestedCount() + : ReadAttribute("tx-ack-requested-count") {} + + ~ReadThreadNetworkDiagnosticsTxAckRequestedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxAckRequestedCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxAckRequestedCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() + : SubscribeAttribute("tx-ack-requested-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxAckRequestedCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatPercentRemainingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatPercentRemaining response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatPercentRemaining read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute TxAckedCount + */ +class ReadThreadNetworkDiagnosticsTxAckedCount : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsTxAckedCount() + : ReadAttribute("tx-acked-count") {} + + ~ReadThreadNetworkDiagnosticsTxAckedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxAckedCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxAckedCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() + : SubscribeAttribute("tx-acked-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxAckedCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatPercentRemaining : public SubscribeAttribute { +/* + * Attribute TxNoAckRequestedCount + */ +class ReadThreadNetworkDiagnosticsTxNoAckRequestedCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatPercentRemaining() - : SubscribeAttribute("bat-percent-remaining") - { - } - - ~SubscribeAttributePowerSourceBatPercentRemaining() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatPercentRemainingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatPercentRemaining response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() + : ReadAttribute("tx-no-ack-requested-count") {} + + ~ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxNoAckRequestedCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxNoAckRequestedCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() + : SubscribeAttribute("tx-no-ack-requested-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxNoAckRequestedCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatTimeRemaining + * Attribute TxDataCount */ -class ReadPowerSourceBatTimeRemaining : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxDataCount : public ReadAttribute { public: - ReadPowerSourceBatTimeRemaining() - : ReadAttribute("bat-time-remaining") - { - } - - ~ReadPowerSourceBatTimeRemaining() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatTimeRemainingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatTimeRemaining response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatTimeRemaining read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxDataCount() : ReadAttribute("tx-data-count") {} + + ~ReadThreadNetworkDiagnosticsTxDataCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxDataCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxDataCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxDataCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() + : SubscribeAttribute("tx-data-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxDataCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatTimeRemaining : public SubscribeAttribute { +/* + * Attribute TxDataPollCount + */ +class ReadThreadNetworkDiagnosticsTxDataPollCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatTimeRemaining() - : SubscribeAttribute("bat-time-remaining") - { - } - - ~SubscribeAttributePowerSourceBatTimeRemaining() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatTimeRemainingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatTimeRemaining response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxDataPollCount() + : ReadAttribute("tx-data-poll-count") {} + + ~ReadThreadNetworkDiagnosticsTxDataPollCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxDataPollCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxDataPollCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() + : SubscribeAttribute("tx-data-poll-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxDataPollCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatChargeLevel + * Attribute TxBeaconCount */ -class ReadPowerSourceBatChargeLevel : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxBeaconCount : public ReadAttribute { public: - ReadPowerSourceBatChargeLevel() - : ReadAttribute("bat-charge-level") - { - } - - ~ReadPowerSourceBatChargeLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatChargeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatChargeLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxBeaconCount() + : ReadAttribute("tx-beacon-count") {} + + ~ReadThreadNetworkDiagnosticsTxBeaconCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxBeaconCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxBeaconCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() + : SubscribeAttribute("tx-beacon-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxBeaconCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatChargeLevel : public SubscribeAttribute { +/* + * Attribute TxBeaconRequestCount + */ +class ReadThreadNetworkDiagnosticsTxBeaconRequestCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatChargeLevel() - : SubscribeAttribute("bat-charge-level") - { - } - - ~SubscribeAttributePowerSourceBatChargeLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatChargeLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxBeaconRequestCount() + : ReadAttribute("tx-beacon-request-count") {} + + ~ReadThreadNetworkDiagnosticsTxBeaconRequestCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000001F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxBeaconRequestCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxBeaconRequestCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() + : SubscribeAttribute("tx-beacon-request-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000001F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxBeaconRequestCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatReplacementNeeded + * Attribute TxOtherCount */ -class ReadPowerSourceBatReplacementNeeded : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxOtherCount : public ReadAttribute { public: - ReadPowerSourceBatReplacementNeeded() - : ReadAttribute("bat-replacement-needed") - { - } - - ~ReadPowerSourceBatReplacementNeeded() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatReplacementNeededWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplacementNeeded response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatReplacementNeeded read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxOtherCount() + : ReadAttribute("tx-other-count") {} + + ~ReadThreadNetworkDiagnosticsTxOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxOtherCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxOtherCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() + : SubscribeAttribute("tx-other-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxOtherCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatReplacementNeeded : public SubscribeAttribute { +/* + * Attribute TxRetryCount + */ +class ReadThreadNetworkDiagnosticsTxRetryCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatReplacementNeeded() - : SubscribeAttribute("bat-replacement-needed") - { - } - - ~SubscribeAttributePowerSourceBatReplacementNeeded() {} + ReadThreadNetworkDiagnosticsTxRetryCount() + : ReadAttribute("tx-retry-count") {} + + ~ReadThreadNetworkDiagnosticsTxRetryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxRetryCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxRetryCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() + : SubscribeAttribute("tx-retry-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxRetryCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatReplacementNeededWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplacementNeeded response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute TxDirectMaxRetryExpiryCount + */ +class ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() + : ReadAttribute("tx-direct-max-retry-expiry-count") {} + + ~ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxDirectMaxRetryExpiryCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics TxDirectMaxRetryExpiryCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() + : SubscribeAttribute("tx-direct-max-retry-expiry-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxDirectMaxRetryExpiryCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute TxIndirectMaxRetryExpiryCount + */ +class ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() + : ReadAttribute("tx-indirect-max-retry-expiry-count") {} + + ~ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000023) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxIndirectMaxRetryExpiryCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics TxIndirectMaxRetryExpiryCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() + : SubscribeAttribute("tx-indirect-max-retry-expiry-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxIndirectMaxRetryExpiryCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatReplaceability + * Attribute TxErrCcaCount */ -class ReadPowerSourceBatReplaceability : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxErrCcaCount : public ReadAttribute { public: - ReadPowerSourceBatReplaceability() - : ReadAttribute("bat-replaceability") - { - } - - ~ReadPowerSourceBatReplaceability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatReplaceabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplaceability response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatReplaceability read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxErrCcaCount() + : ReadAttribute("tx-err-cca-count") {} + + ~ReadThreadNetworkDiagnosticsTxErrCcaCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxErrCcaCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxErrCcaCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() + : SubscribeAttribute("tx-err-cca-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxErrCcaCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatReplaceability : public SubscribeAttribute { +/* + * Attribute TxErrAbortCount + */ +class ReadThreadNetworkDiagnosticsTxErrAbortCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatReplaceability() - : SubscribeAttribute("bat-replaceability") - { - } - - ~SubscribeAttributePowerSourceBatReplaceability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatReplaceabilityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplaceability response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxErrAbortCount() + : ReadAttribute("tx-err-abort-count") {} + + ~ReadThreadNetworkDiagnosticsTxErrAbortCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxErrAbortCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxErrAbortCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() + : SubscribeAttribute("tx-err-abort-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxErrAbortCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatPresent + * Attribute TxErrBusyChannelCount */ -class ReadPowerSourceBatPresent : public ReadAttribute { +class ReadThreadNetworkDiagnosticsTxErrBusyChannelCount : public ReadAttribute { public: - ReadPowerSourceBatPresent() - : ReadAttribute("bat-present") - { - } - - ~ReadPowerSourceBatPresent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatPresentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatPresent response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatPresent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() + : ReadAttribute("tx-err-busy-channel-count") {} + + ~ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000026) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxErrBusyChannelCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics TxErrBusyChannelCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() + : SubscribeAttribute("tx-err-busy-channel-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxErrBusyChannelCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatPresent : public SubscribeAttribute { +/* + * Attribute RxTotalCount + */ +class ReadThreadNetworkDiagnosticsRxTotalCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatPresent() - : SubscribeAttribute("bat-present") - { - } - - ~SubscribeAttributePowerSourceBatPresent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatPresentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatPresent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxTotalCount() + : ReadAttribute("rx-total-count") {} + + ~ReadThreadNetworkDiagnosticsRxTotalCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000027) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxTotalCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxTotalCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() + : SubscribeAttribute("rx-total-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxTotalCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveBatFaults + * Attribute RxUnicastCount */ -class ReadPowerSourceActiveBatFaults : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxUnicastCount : public ReadAttribute { public: - ReadPowerSourceActiveBatFaults() - : ReadAttribute("active-bat-faults") - { - } - - ~ReadPowerSourceActiveBatFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveBatFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveBatFaults response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource ActiveBatFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxUnicastCount() + : ReadAttribute("rx-unicast-count") {} + + ~ReadThreadNetworkDiagnosticsRxUnicastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000028) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxUnicastCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxUnicastCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() + : SubscribeAttribute("rx-unicast-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxUnicastCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceActiveBatFaults : public SubscribeAttribute { +/* + * Attribute RxBroadcastCount + */ +class ReadThreadNetworkDiagnosticsRxBroadcastCount : public ReadAttribute { public: - SubscribeAttributePowerSourceActiveBatFaults() - : SubscribeAttribute("active-bat-faults") - { - } - - ~SubscribeAttributePowerSourceActiveBatFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveBatFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveBatFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxBroadcastCount() + : ReadAttribute("rx-broadcast-count") {} + + ~ReadThreadNetworkDiagnosticsRxBroadcastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxBroadcastCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxBroadcastCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() + : SubscribeAttribute("rx-broadcast-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxBroadcastCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatReplacementDescription + * Attribute RxDataCount */ -class ReadPowerSourceBatReplacementDescription : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxDataCount : public ReadAttribute { public: - ReadPowerSourceBatReplacementDescription() - : ReadAttribute("bat-replacement-description") - { - } - - ~ReadPowerSourceBatReplacementDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatReplacementDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplacementDescription response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatReplacementDescription read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxDataCount() : ReadAttribute("rx-data-count") {} + + ~ReadThreadNetworkDiagnosticsRxDataCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxDataCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxDataCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxDataCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() + : SubscribeAttribute("rx-data-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxDataCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatReplacementDescription : public SubscribeAttribute { +/* + * Attribute RxDataPollCount + */ +class ReadThreadNetworkDiagnosticsRxDataPollCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatReplacementDescription() - : SubscribeAttribute("bat-replacement-description") - { - } - - ~SubscribeAttributePowerSourceBatReplacementDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatReplacementDescriptionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatReplacementDescription response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxDataPollCount() + : ReadAttribute("rx-data-poll-count") {} + + ~ReadThreadNetworkDiagnosticsRxDataPollCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxDataPollCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxDataPollCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() + : SubscribeAttribute("rx-data-poll-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxDataPollCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatCommonDesignation + * Attribute RxBeaconCount */ -class ReadPowerSourceBatCommonDesignation : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxBeaconCount : public ReadAttribute { public: - ReadPowerSourceBatCommonDesignation() - : ReadAttribute("bat-common-designation") - { - } - - ~ReadPowerSourceBatCommonDesignation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatCommonDesignationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatCommonDesignation response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatCommonDesignation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxBeaconCount() + : ReadAttribute("rx-beacon-count") {} + + ~ReadThreadNetworkDiagnosticsRxBeaconCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxBeaconCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxBeaconCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() + : SubscribeAttribute("rx-beacon-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxBeaconCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatCommonDesignation : public SubscribeAttribute { +/* + * Attribute RxBeaconRequestCount + */ +class ReadThreadNetworkDiagnosticsRxBeaconRequestCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatCommonDesignation() - : SubscribeAttribute("bat-common-designation") - { - } - - ~SubscribeAttributePowerSourceBatCommonDesignation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatCommonDesignationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatCommonDesignation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxBeaconRequestCount() + : ReadAttribute("rx-beacon-request-count") {} + + ~ReadThreadNetworkDiagnosticsRxBeaconRequestCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxBeaconRequestCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxBeaconRequestCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() + : SubscribeAttribute("rx-beacon-request-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxBeaconRequestCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatANSIDesignation + * Attribute RxOtherCount */ -class ReadPowerSourceBatANSIDesignation : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxOtherCount : public ReadAttribute { public: - ReadPowerSourceBatANSIDesignation() - : ReadAttribute("bat-ansidesignation") - { - } - - ~ReadPowerSourceBatANSIDesignation() {} + ReadThreadNetworkDiagnosticsRxOtherCount() + : ReadAttribute("rx-other-count") {} + + ~ReadThreadNetworkDiagnosticsRxOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxOtherCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxOtherCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() + : SubscribeAttribute("rx-other-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxOtherCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000015) on endpoint %u", endpointId); +/* + * Attribute RxAddressFilteredCount + */ +class ReadThreadNetworkDiagnosticsRxAddressFilteredCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsRxAddressFilteredCount() + : ReadAttribute("rx-address-filtered-count") {} + + ~ReadThreadNetworkDiagnosticsRxAddressFilteredCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000002F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxAddressFilteredCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxAddressFilteredCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() + : SubscribeAttribute("rx-address-filtered-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000002F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxAddressFilteredCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatANSIDesignationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatANSIDesignation response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatANSIDesignation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute RxDestAddrFilteredCount + */ +class ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() + : ReadAttribute("rx-dest-addr-filtered-count") {} + + ~ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxDestAddrFilteredCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics RxDestAddrFilteredCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() + : SubscribeAttribute("rx-dest-addr-filtered-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxDestAddrFilteredCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatANSIDesignation : public SubscribeAttribute { +/* + * Attribute RxDuplicatedCount + */ +class ReadThreadNetworkDiagnosticsRxDuplicatedCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatANSIDesignation() - : SubscribeAttribute("bat-ansidesignation") - { - } - - ~SubscribeAttributePowerSourceBatANSIDesignation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatANSIDesignationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatANSIDesignation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; + ReadThreadNetworkDiagnosticsRxDuplicatedCount() + : ReadAttribute("rx-duplicated-count") {} + + ~ReadThreadNetworkDiagnosticsRxDuplicatedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxDuplicatedCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxDuplicatedCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() + : SubscribeAttribute("rx-duplicated-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxDuplicatedCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; /* - * Attribute BatIECDesignation + * Attribute RxErrNoFrameCount */ -class ReadPowerSourceBatIECDesignation : public ReadAttribute { -public: - ReadPowerSourceBatIECDesignation() - : ReadAttribute("bat-iecdesignation") - { - } - - ~ReadPowerSourceBatIECDesignation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatIECDesignationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatIECDesignation response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatIECDesignation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePowerSourceBatIECDesignation : public SubscribeAttribute { +class ReadThreadNetworkDiagnosticsRxErrNoFrameCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatIECDesignation() - : SubscribeAttribute("bat-iecdesignation") - { - } - - ~SubscribeAttributePowerSourceBatIECDesignation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatIECDesignationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatIECDesignation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxErrNoFrameCount() + : ReadAttribute("rx-err-no-frame-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrNoFrameCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrNoFrameCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxErrNoFrameCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() + : SubscribeAttribute("rx-err-no-frame-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrNoFrameCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatApprovedChemistry + * Attribute RxErrUnknownNeighborCount */ -class ReadPowerSourceBatApprovedChemistry : public ReadAttribute { -public: - ReadPowerSourceBatApprovedChemistry() - : ReadAttribute("bat-approved-chemistry") - { - } - - ~ReadPowerSourceBatApprovedChemistry() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatApprovedChemistryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatApprovedChemistry response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatApprovedChemistry read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() + : ReadAttribute("rx-err-unknown-neighbor-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000033) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrUnknownNeighborCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics RxErrUnknownNeighborCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() + : SubscribeAttribute("rx-err-unknown-neighbor-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrUnknownNeighborCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatApprovedChemistry : public SubscribeAttribute { -public: - SubscribeAttributePowerSourceBatApprovedChemistry() - : SubscribeAttribute("bat-approved-chemistry") - { - } - - ~SubscribeAttributePowerSourceBatApprovedChemistry() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatApprovedChemistryWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatApprovedChemistry response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute RxErrInvalidSrcAddrCount + */ +class ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() + : ReadAttribute("rx-err-invalid-src-addr-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000034) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics RxErrInvalidSrcAddrCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() + : SubscribeAttribute("rx-err-invalid-src-addr-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrInvalidSrcAddrCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatCapacity + * Attribute RxErrSecCount */ -class ReadPowerSourceBatCapacity : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxErrSecCount : public ReadAttribute { public: - ReadPowerSourceBatCapacity() - : ReadAttribute("bat-capacity") - { - } - - ~ReadPowerSourceBatCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000018) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatCapacity response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatCapacity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxErrSecCount() + : ReadAttribute("rx-err-sec-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrSecCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000035) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrSecCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxErrSecCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() + : SubscribeAttribute("rx-err-sec-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrSecCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatCapacity : public SubscribeAttribute { +/* + * Attribute RxErrFcsCount + */ +class ReadThreadNetworkDiagnosticsRxErrFcsCount : public ReadAttribute { public: - SubscribeAttributePowerSourceBatCapacity() - : SubscribeAttribute("bat-capacity") - { - } - - ~SubscribeAttributePowerSourceBatCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatCapacityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatCapacity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxErrFcsCount() + : ReadAttribute("rx-err-fcs-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrFcsCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000036) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrFcsCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxErrFcsCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() + : SubscribeAttribute("rx-err-fcs-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000036) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrFcsCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatQuantity + * Attribute RxErrOtherCount */ -class ReadPowerSourceBatQuantity : public ReadAttribute { +class ReadThreadNetworkDiagnosticsRxErrOtherCount : public ReadAttribute { public: - ReadPowerSourceBatQuantity() - : ReadAttribute("bat-quantity") - { - } - - ~ReadPowerSourceBatQuantity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatQuantityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatQuantity response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatQuantity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsRxErrOtherCount() + : ReadAttribute("rx-err-other-count") {} + + ~ReadThreadNetworkDiagnosticsRxErrOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000037) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRxErrOtherCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics RxErrOtherCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() + : SubscribeAttribute("rx-err-other-count") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000037) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRxErrOtherCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatQuantity : public SubscribeAttribute { +/* + * Attribute ActiveTimestamp + */ +class ReadThreadNetworkDiagnosticsActiveTimestamp : public ReadAttribute { public: - SubscribeAttributePowerSourceBatQuantity() - : SubscribeAttribute("bat-quantity") - { - } - - ~SubscribeAttributePowerSourceBatQuantity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatQuantityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatQuantity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsActiveTimestamp() + : ReadAttribute("active-timestamp") {} + + ~ReadThreadNetworkDiagnosticsActiveTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000038) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveTimestampWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ActiveTimestamp read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() + : SubscribeAttribute("active-timestamp") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000038) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveTimestampWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatChargeState + * Attribute PendingTimestamp */ -class ReadPowerSourceBatChargeState : public ReadAttribute { +class ReadThreadNetworkDiagnosticsPendingTimestamp : public ReadAttribute { public: - ReadPowerSourceBatChargeState() - : ReadAttribute("bat-charge-state") - { - } - - ~ReadPowerSourceBatChargeState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatChargeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargeState response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatChargeState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsPendingTimestamp() + : ReadAttribute("pending-timestamp") {} + + ~ReadThreadNetworkDiagnosticsPendingTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x00000039) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePendingTimestampWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics PendingTimestamp read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() + : SubscribeAttribute("pending-timestamp") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x00000039) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePendingTimestampWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatChargeState : public SubscribeAttribute { +/* + * Attribute Delay + */ +class ReadThreadNetworkDiagnosticsDelay : public ReadAttribute { public: - SubscribeAttributePowerSourceBatChargeState() - : SubscribeAttribute("bat-charge-state") - { - } - - ~SubscribeAttributePowerSourceBatChargeState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatChargeStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargeState response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsDelay() : ReadAttribute("delay") {} + + ~ReadThreadNetworkDiagnosticsDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDelayWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics Delay read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsDelay + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsDelay() + : SubscribeAttribute("delay") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDelayWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.Delay response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatTimeToFullCharge + * Attribute SecurityPolicy */ -class ReadPowerSourceBatTimeToFullCharge : public ReadAttribute { +class ReadThreadNetworkDiagnosticsSecurityPolicy : public ReadAttribute { public: - ReadPowerSourceBatTimeToFullCharge() - : ReadAttribute("bat-time-to-full-charge") - { - } - - ~ReadPowerSourceBatTimeToFullCharge() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatTimeToFullChargeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatTimeToFullCharge response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatTimeToFullCharge read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsSecurityPolicy() + : ReadAttribute("security-policy") {} + + ~ReadThreadNetworkDiagnosticsSecurityPolicy() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000003B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeSecurityPolicyWithCompletion:^( + MTRThreadNetworkDiagnosticsClusterSecurityPolicy *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics SecurityPolicy read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() + : SubscribeAttribute("security-policy") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000003B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSecurityPolicyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^( + MTRThreadNetworkDiagnosticsClusterSecurityPolicy *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatTimeToFullCharge : public SubscribeAttribute { +/* + * Attribute ChannelPage0Mask + */ +class ReadThreadNetworkDiagnosticsChannelPage0Mask : public ReadAttribute { public: - SubscribeAttributePowerSourceBatTimeToFullCharge() - : SubscribeAttribute("bat-time-to-full-charge") - { - } - - ~SubscribeAttributePowerSourceBatTimeToFullCharge() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatTimeToFullChargeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatTimeToFullCharge response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsChannelPage0Mask() + : ReadAttribute("channel-page0mask") {} + + ~ReadThreadNetworkDiagnosticsChannelPage0Mask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000003C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeChannelPage0MaskWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ChannelPage0Mask read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() + : SubscribeAttribute("channel-page0mask") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000003C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeChannelPage0MaskWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatFunctionalWhileCharging + * Attribute OperationalDatasetComponents */ -class ReadPowerSourceBatFunctionalWhileCharging : public ReadAttribute { -public: - ReadPowerSourceBatFunctionalWhileCharging() - : ReadAttribute("bat-functional-while-charging") - { - } - - ~ReadPowerSourceBatFunctionalWhileCharging() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000001C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatFunctionalWhileChargingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatFunctionalWhileCharging read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadThreadNetworkDiagnosticsOperationalDatasetComponents + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsOperationalDatasetComponents() + : ReadAttribute("operational-dataset-components") {} + + ~ReadThreadNetworkDiagnosticsOperationalDatasetComponents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000003D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOperationalDatasetComponentsWithCompletion:^( + MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents + *_Nullable value, + NSError *_Nullable error) { + NSLog( + @"ThreadNetworkDiagnostics.OperationalDatasetComponents response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics OperationalDatasetComponents read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() + : SubscribeAttribute("operational-dataset-components") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000003D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOperationalDatasetComponentsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^( + MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents + *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatFunctionalWhileCharging : public SubscribeAttribute { -public: - SubscribeAttributePowerSourceBatFunctionalWhileCharging() - : SubscribeAttribute("bat-functional-while-charging") - { - } - - ~SubscribeAttributePowerSourceBatFunctionalWhileCharging() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatFunctionalWhileChargingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute ActiveNetworkFaultsList + */ +class ReadThreadNetworkDiagnosticsActiveNetworkFaultsList + : public ReadAttribute { +public: + ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() + : ReadAttribute("active-network-faults-list") {} + + ~ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000003E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveNetworkFaultsListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThreadNetworkDiagnostics ActiveNetworkFaultsList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() + : SubscribeAttribute("active-network-faults-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000003E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveNetworkFaultsListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BatChargingCurrent + * Attribute GeneratedCommandList */ -class ReadPowerSourceBatChargingCurrent : public ReadAttribute { +class ReadThreadNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { public: - ReadPowerSourceBatChargingCurrent() - : ReadAttribute("bat-charging-current") - { - } - - ~ReadPowerSourceBatChargingCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000001D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBatChargingCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargingCurrent response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource BatChargingCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadThreadNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceBatChargingCurrent : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadThreadNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributePowerSourceBatChargingCurrent() - : SubscribeAttribute("bat-charging-current") - { - } - - ~SubscribeAttributePowerSourceBatChargingCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000001D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBatChargingCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.BatChargingCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadThreadNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveBatChargeFaults + * Attribute AttributeList */ -class ReadPowerSourceActiveBatChargeFaults : public ReadAttribute { +class ReadThreadNetworkDiagnosticsAttributeList : public ReadAttribute { public: - ReadPowerSourceActiveBatChargeFaults() - : ReadAttribute("active-bat-charge-faults") - { - } - - ~ReadPowerSourceActiveBatChargeFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000001E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveBatChargeFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveBatChargeFaults response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource ActiveBatChargeFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadThreadNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceActiveBatChargeFaults : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadThreadNetworkDiagnosticsFeatureMap : public ReadAttribute { public: - SubscribeAttributePowerSourceActiveBatChargeFaults() - : SubscribeAttribute("active-bat-charge-faults") - { - } - - ~SubscribeAttributePowerSourceActiveBatChargeFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000001E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveBatChargeFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ActiveBatChargeFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadThreadNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ClusterRevision */ -class ReadPowerSourceGeneratedCommandList : public ReadAttribute { +class ReadThreadNetworkDiagnosticsClusterRevision : public ReadAttribute { public: - ReadPowerSourceGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadPowerSourceGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThreadNetworkDiagnosticsClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadThreadNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("ThreadNetworkDiagnostics ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDiagnosticsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000035) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePowerSourceGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributePowerSourceGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster WiFiNetworkDiagnostics | 0x0036 | +|------------------------------------------------------------------------------| +| Commands: | | +| * ResetCounts | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Bssid | 0x0000 | +| * SecurityType | 0x0001 | +| * WiFiVersion | 0x0002 | +| * ChannelNumber | 0x0003 | +| * Rssi | 0x0004 | +| * BeaconLostCount | 0x0005 | +| * BeaconRxCount | 0x0006 | +| * PacketMulticastRxCount | 0x0007 | +| * PacketMulticastTxCount | 0x0008 | +| * PacketUnicastRxCount | 0x0009 | +| * PacketUnicastTxCount | 0x000A | +| * CurrentMaxRate | 0x000B | +| * OverrunCount | 0x000C | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * Disconnection | 0x0000 | +| * AssociationFailure | 0x0001 | +| * ConnectionStatus | 0x0002 | +\*----------------------------------------------------------------------------*/ /* - * Attribute AcceptedCommandList + * Command ResetCounts */ -class ReadPowerSourceAcceptedCommandList : public ReadAttribute { +class WiFiNetworkDiagnosticsResetCounts : public ClusterCommand { public: - ReadPowerSourceAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + WiFiNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000036) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWiFiNetworkDiagnosticsClusterResetCountsParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster resetCountsWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadPowerSourceAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributePowerSourceAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute Bssid + */ +class ReadWiFiNetworkDiagnosticsBssid : public ReadAttribute { public: - SubscribeAttributePowerSourceAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributePowerSourceAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWiFiNetworkDiagnosticsBssid() : ReadAttribute("bssid") {} + + ~ReadWiFiNetworkDiagnosticsBssid() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBssidWithCompletion:^(NSData *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.Bssid response %@", [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics Bssid read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsBssid + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsBssid() + : SubscribeAttribute("bssid") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsBssid() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBssidWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.Bssid response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute SecurityType */ -class ReadPowerSourceAttributeList : public ReadAttribute { +class ReadWiFiNetworkDiagnosticsSecurityType : public ReadAttribute { public: - ReadPowerSourceAttributeList() - : ReadAttribute("attribute-list") - { - } + ReadWiFiNetworkDiagnosticsSecurityType() : ReadAttribute("security-type") {} + + ~ReadWiFiNetworkDiagnosticsSecurityType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSecurityTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics SecurityType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsSecurityType + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() + : SubscribeAttribute("security-type") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSecurityTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadPowerSourceAttributeList() {} +/* + * Attribute WiFiVersion + */ +class ReadWiFiNetworkDiagnosticsWiFiVersion : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsWiFiVersion() : ReadAttribute("wi-fi-version") {} + + ~ReadWiFiNetworkDiagnosticsWiFiVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWiFiVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics WiFiVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() + : SubscribeAttribute("wi-fi-version") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiFiVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +/* + * Attribute ChannelNumber + */ +class ReadWiFiNetworkDiagnosticsChannelNumber : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsChannelNumber() : ReadAttribute("channel-number") {} + + ~ReadWiFiNetworkDiagnosticsChannelNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeChannelNumberWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics ChannelNumber read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() + : SubscribeAttribute("channel-number") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeChannelNumberWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Rssi + */ +class ReadWiFiNetworkDiagnosticsRssi : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsRssi() : ReadAttribute("rssi") {} + + ~ReadWiFiNetworkDiagnosticsRssi() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRssiWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.Rssi response %@", [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics Rssi read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceAttributeList : public SubscribeAttribute { +class SubscribeAttributeWiFiNetworkDiagnosticsRssi : public SubscribeAttribute { public: - SubscribeAttributePowerSourceAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeWiFiNetworkDiagnosticsRssi() : SubscribeAttribute("rssi") {} - ~SubscribeAttributePowerSourceAttributeList() {} + ~SubscribeAttributeWiFiNetworkDiagnosticsRssi() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRssiWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.Rssi response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute BeaconLostCount */ -class ReadPowerSourceFeatureMap : public ReadAttribute { +class ReadWiFiNetworkDiagnosticsBeaconLostCount : public ReadAttribute { public: - ReadPowerSourceFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadPowerSourceFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWiFiNetworkDiagnosticsBeaconLostCount() + : ReadAttribute("beacon-lost-count") {} + + ~ReadWiFiNetworkDiagnosticsBeaconLostCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBeaconLostCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics BeaconLostCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() + : SubscribeAttribute("beacon-lost-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBeaconLostCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceFeatureMap : public SubscribeAttribute { +/* + * Attribute BeaconRxCount + */ +class ReadWiFiNetworkDiagnosticsBeaconRxCount : public ReadAttribute { public: - SubscribeAttributePowerSourceFeatureMap() - : SubscribeAttribute("feature-map") - { - } + ReadWiFiNetworkDiagnosticsBeaconRxCount() + : ReadAttribute("beacon-rx-count") {} + + ~ReadWiFiNetworkDiagnosticsBeaconRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBeaconRxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics BeaconRxCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() + : SubscribeAttribute("beacon-rx-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBeaconRxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributePowerSourceFeatureMap() {} +/* + * Attribute PacketMulticastRxCount + */ +class ReadWiFiNetworkDiagnosticsPacketMulticastRxCount : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() + : ReadAttribute("packet-multicast-rx-count") {} + + ~ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketMulticastRxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics PacketMulticastRxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() + : SubscribeAttribute("packet-multicast-rx-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketMulticastRxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute PacketMulticastTxCount + */ +class ReadWiFiNetworkDiagnosticsPacketMulticastTxCount : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() + : ReadAttribute("packet-multicast-tx-count") {} + + ~ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketMulticastTxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics PacketMulticastTxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() + : SubscribeAttribute("packet-multicast-tx-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketMulticastTxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute PacketUnicastRxCount + */ +class ReadWiFiNetworkDiagnosticsPacketUnicastRxCount : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() + : ReadAttribute("packet-unicast-rx-count") {} + + ~ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketUnicastRxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics PacketUnicastRxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() + : SubscribeAttribute("packet-unicast-rx-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketUnicastRxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute PacketUnicastTxCount */ -class ReadPowerSourceClusterRevision : public ReadAttribute { +class ReadWiFiNetworkDiagnosticsPacketUnicastTxCount : public ReadAttribute { public: - ReadPowerSourceClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() + : ReadAttribute("packet-unicast-tx-count") {} + + ~ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketUnicastTxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics PacketUnicastTxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() + : SubscribeAttribute("packet-unicast-tx-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketUnicastTxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadPowerSourceClusterRevision() {} +/* + * Attribute CurrentMaxRate + */ +class ReadWiFiNetworkDiagnosticsCurrentMaxRate : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsCurrentMaxRate() + : ReadAttribute("current-max-rate") {} + + ~ReadWiFiNetworkDiagnosticsCurrentMaxRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentMaxRateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics CurrentMaxRate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() + : SubscribeAttribute("current-max-rate") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentMaxRateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +/* + * Attribute OverrunCount + */ +class ReadWiFiNetworkDiagnosticsOverrunCount : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsOverrunCount() : ReadAttribute("overrun-count") {} + + ~ReadWiFiNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOverrunCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics OverrunCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() + : SubscribeAttribute("overrun-count") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOverrunCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("PowerSource ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadWiFiNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadWiFiNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributePowerSourceClusterRevision : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadWiFiNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributePowerSourceClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadWiFiNetworkDiagnosticsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadWiFiNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributePowerSourceClusterRevision() {} +/* + * Attribute AttributeList + */ +class ReadWiFiNetworkDiagnosticsAttributeList : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadWiFiNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000002F) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PowerSource.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute FeatureMap + */ +class ReadWiFiNetworkDiagnosticsFeatureMap : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadWiFiNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadWiFiNetworkDiagnosticsClusterRevision : public ReadAttribute { +public: + ReadWiFiNetworkDiagnosticsClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadWiFiNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("WiFiNetworkDiagnostics ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000036) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster GeneralCommissioning | 0x0030 | +| Cluster EthernetNetworkDiagnostics | 0x0037 | |------------------------------------------------------------------------------| | Commands: | | -| * ArmFailSafe | 0x00 | -| * SetRegulatoryConfig | 0x02 | -| * CommissioningComplete | 0x04 | +| * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Breadcrumb | 0x0000 | -| * BasicCommissioningInfo | 0x0001 | -| * RegulatoryConfig | 0x0002 | -| * LocationCapability | 0x0003 | -| * SupportsConcurrentConnection | 0x0004 | +| * PHYRate | 0x0000 | +| * FullDuplex | 0x0001 | +| * PacketRxCount | 0x0002 | +| * PacketTxCount | 0x0003 | +| * TxErrCount | 0x0004 | +| * CollisionCount | 0x0005 | +| * OverrunCount | 0x0006 | +| * CarrierDetect | 0x0007 | +| * TimeSinceReset | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -18882,917 +34583,2922 @@ class SubscribeAttributePowerSourceClusterRevision : public SubscribeAttribute { \*----------------------------------------------------------------------------*/ /* - * Command ArmFailSafe + * Command ResetCounts */ -class GeneralCommissioningArmFailSafe : public ClusterCommand { +class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand { public: - GeneralCommissioningArmFailSafe() - : ClusterCommand("arm-fail-safe") - { - AddArgument("ExpiryLengthSeconds", 0, UINT16_MAX, &mRequest.expiryLengthSeconds); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGeneralCommissioningClusterArmFailSafeParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.expiryLengthSeconds = [NSNumber numberWithUnsignedShort:mRequest.expiryLengthSeconds]; - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster armFailSafeWithParams:params - completion:^(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + EthernetNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000037) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTREthernetNetworkDiagnosticsClusterResetCountsParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster resetCountsWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type mRequest; }; /* - * Command SetRegulatoryConfig + * Attribute PHYRate */ -class GeneralCommissioningSetRegulatoryConfig : public ClusterCommand { +class ReadEthernetNetworkDiagnosticsPHYRate : public ReadAttribute { public: - GeneralCommissioningSetRegulatoryConfig() - : ClusterCommand("set-regulatory-config") - { - AddArgument("NewRegulatoryConfig", 0, UINT8_MAX, &mRequest.newRegulatoryConfig); - AddArgument("CountryCode", &mRequest.countryCode); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGeneralCommissioningClusterSetRegulatoryConfigParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.newRegulatoryConfig = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.newRegulatoryConfig)]; - params.countryCode = [[NSString alloc] initWithBytes:mRequest.countryCode.data() - length:mRequest.countryCode.size() - encoding:NSUTF8StringEncoding]; - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - setRegulatoryConfigWithParams:params - completion:^(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type mRequest; + ReadEthernetNetworkDiagnosticsPHYRate() : ReadAttribute("phyrate") {} + + ~ReadEthernetNetworkDiagnosticsPHYRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePHYRateWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics PHYRate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsPHYRate + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() + : SubscribeAttribute("phyrate") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePHYRateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command CommissioningComplete + * Attribute FullDuplex */ -class GeneralCommissioningCommissioningComplete : public ClusterCommand { +class ReadEthernetNetworkDiagnosticsFullDuplex : public ReadAttribute { public: - GeneralCommissioningCommissioningComplete() - : ClusterCommand("commissioning-complete") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGeneralCommissioningClusterCommissioningCompleteParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster commissioningCompleteWithParams:params - completion:^( - MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: + ReadEthernetNetworkDiagnosticsFullDuplex() : ReadAttribute("full-duplex") {} + + ~ReadEthernetNetworkDiagnosticsFullDuplex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFullDuplexWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics FullDuplex read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() + : SubscribeAttribute("full-duplex") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFullDuplexWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Breadcrumb + * Attribute PacketRxCount */ -class ReadGeneralCommissioningBreadcrumb : public ReadAttribute { +class ReadEthernetNetworkDiagnosticsPacketRxCount : public ReadAttribute { public: - ReadGeneralCommissioningBreadcrumb() - : ReadAttribute("breadcrumb") - { - } - - ~ReadGeneralCommissioningBreadcrumb() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.Breadcrumb response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning Breadcrumb read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsPacketRxCount() + : ReadAttribute("packet-rx-count") {} + + ~ReadEthernetNetworkDiagnosticsPacketRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketRxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics PacketRxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() + : SubscribeAttribute("packet-rx-count") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketRxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteGeneralCommissioningBreadcrumb : public WriteAttribute { +/* + * Attribute PacketTxCount + */ +class ReadEthernetNetworkDiagnosticsPacketTxCount : public ReadAttribute { public: - WriteGeneralCommissioningBreadcrumb() - : WriteAttribute("breadcrumb") - { - AddArgument("attr-name", "breadcrumb"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteGeneralCommissioningBreadcrumb() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeBreadcrumbWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("GeneralCommissioning Breadcrumb write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint64_t mValue; + ReadEthernetNetworkDiagnosticsPacketTxCount() + : ReadAttribute("packet-tx-count") {} + + ~ReadEthernetNetworkDiagnosticsPacketTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePacketTxCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics PacketTxCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() + : SubscribeAttribute("packet-tx-count") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePacketTxCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningBreadcrumb : public SubscribeAttribute { +/* + * Attribute TxErrCount + */ +class ReadEthernetNetworkDiagnosticsTxErrCount : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningBreadcrumb() - : SubscribeAttribute("breadcrumb") - { - } - - ~SubscribeAttributeGeneralCommissioningBreadcrumb() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBreadcrumbWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.Breadcrumb response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsTxErrCount() : ReadAttribute("tx-err-count") {} + + ~ReadEthernetNetworkDiagnosticsTxErrCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTxErrCountWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics TxErrCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() + : SubscribeAttribute("tx-err-count") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTxErrCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BasicCommissioningInfo + * Attribute CollisionCount */ -class ReadGeneralCommissioningBasicCommissioningInfo : public ReadAttribute { +class ReadEthernetNetworkDiagnosticsCollisionCount : public ReadAttribute { public: - ReadGeneralCommissioningBasicCommissioningInfo() - : ReadAttribute("basic-commissioning-info") - { - } - - ~ReadGeneralCommissioningBasicCommissioningInfo() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBasicCommissioningInfoWithCompletion:^( - MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning BasicCommissioningInfo read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsCollisionCount() + : ReadAttribute("collision-count") {} + + ~ReadEthernetNetworkDiagnosticsCollisionCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCollisionCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics CollisionCount read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() + : SubscribeAttribute("collision-count") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCollisionCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo : public SubscribeAttribute { +/* + * Attribute OverrunCount + */ +class ReadEthernetNetworkDiagnosticsOverrunCount : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() - : SubscribeAttribute("basic-commissioning-info") - { - } - - ~SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBasicCommissioningInfoWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsOverrunCount() + : ReadAttribute("overrun-count") {} + + ~ReadEthernetNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOverrunCountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics OverrunCount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() + : SubscribeAttribute("overrun-count") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOverrunCountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RegulatoryConfig + * Attribute CarrierDetect */ -class ReadGeneralCommissioningRegulatoryConfig : public ReadAttribute { +class ReadEthernetNetworkDiagnosticsCarrierDetect : public ReadAttribute { public: - ReadGeneralCommissioningRegulatoryConfig() - : ReadAttribute("regulatory-config") - { - } - - ~ReadGeneralCommissioningRegulatoryConfig() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning RegulatoryConfig read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsCarrierDetect() + : ReadAttribute("carrier-detect") {} + + ~ReadEthernetNetworkDiagnosticsCarrierDetect() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCarrierDetectWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics CarrierDetect read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() + : SubscribeAttribute("carrier-detect") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCarrierDetectWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningRegulatoryConfig : public SubscribeAttribute { +/* + * Attribute TimeSinceReset + */ +class ReadEthernetNetworkDiagnosticsTimeSinceReset : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningRegulatoryConfig() - : SubscribeAttribute("regulatory-config") - { - } - - ~SubscribeAttributeGeneralCommissioningRegulatoryConfig() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRegulatoryConfigWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", [value description]); - SetCommandExitStatus(error); - }]; + ReadEthernetNetworkDiagnosticsTimeSinceReset() + : ReadAttribute("time-since-reset") {} + + ~ReadEthernetNetworkDiagnosticsTimeSinceReset() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTimeSinceResetWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics TimeSinceReset read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() + : SubscribeAttribute("time-since-reset") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTimeSinceResetWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadEthernetNetworkDiagnosticsGeneratedCommandList + : public ReadAttribute { +public: + ReadEthernetNetworkDiagnosticsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadEthernetNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LocationCapability + * Attribute AcceptedCommandList */ -class ReadGeneralCommissioningLocationCapability : public ReadAttribute { +class ReadEthernetNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: - ReadGeneralCommissioningLocationCapability() - : ReadAttribute("location-capability") - { - } - - ~ReadGeneralCommissioningLocationCapability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.LocationCapability response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning LocationCapability read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadEthernetNetworkDiagnosticsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadEthernetNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningLocationCapability : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadEthernetNetworkDiagnosticsAttributeList : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningLocationCapability() - : SubscribeAttribute("location-capability") - { - } - - ~SubscribeAttributeGeneralCommissioningLocationCapability() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocationCapabilityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.LocationCapability response %@", [value description]); - SetCommandExitStatus(error); - }]; + ReadEthernetNetworkDiagnosticsAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadEthernetNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadEthernetNetworkDiagnosticsFeatureMap : public ReadAttribute { +public: + ReadEthernetNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadEthernetNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SupportsConcurrentConnection + * Attribute ClusterRevision */ -class ReadGeneralCommissioningSupportsConcurrentConnection : public ReadAttribute { +class ReadEthernetNetworkDiagnosticsClusterRevision : public ReadAttribute { public: - ReadGeneralCommissioningSupportsConcurrentConnection() - : ReadAttribute("supports-concurrent-connection") - { - } + ReadEthernetNetworkDiagnosticsClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadEthernetNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("EthernetNetworkDiagnostics ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000037) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadGeneralCommissioningSupportsConcurrentConnection() {} +/*----------------------------------------------------------------------------*\ +| Cluster BridgedDeviceBasic | 0x0039 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * VendorName | 0x0001 | +| * VendorID | 0x0002 | +| * ProductName | 0x0003 | +| * NodeLabel | 0x0005 | +| * HardwareVersion | 0x0007 | +| * HardwareVersionString | 0x0008 | +| * SoftwareVersion | 0x0009 | +| * SoftwareVersionString | 0x000A | +| * ManufacturingDate | 0x000B | +| * PartNumber | 0x000C | +| * ProductURL | 0x000D | +| * ProductLabel | 0x000E | +| * SerialNumber | 0x000F | +| * Reachable | 0x0011 | +| * UniqueID | 0x0012 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * StartUp | 0x0000 | +| * ShutDown | 0x0001 | +| * Leave | 0x0002 | +| * ReachableChanged | 0x0003 | +\*----------------------------------------------------------------------------*/ - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x00000004) on endpoint %u", endpointId); +/* + * Attribute VendorName + */ +class ReadBridgedDeviceBasicVendorName : public ReadAttribute { +public: + ReadBridgedDeviceBasicVendorName() : ReadAttribute("vendor-name") {} + + ~ReadBridgedDeviceBasicVendorName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorNameWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.VendorName response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic VendorName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicVendorName + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicVendorName() + : SubscribeAttribute("vendor-name") {} + + ~SubscribeAttributeBridgedDeviceBasicVendorName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.VendorName response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.SupportsConcurrentConnection response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning SupportsConcurrentConnection read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute VendorID + */ +class ReadBridgedDeviceBasicVendorID : public ReadAttribute { +public: + ReadBridgedDeviceBasicVendorID() : ReadAttribute("vendor-id") {} + + ~ReadBridgedDeviceBasicVendorID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorIDWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.VendorID response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic VendorID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection : public SubscribeAttribute { +class SubscribeAttributeBridgedDeviceBasicVendorID : public SubscribeAttribute { public: - SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() - : SubscribeAttribute("supports-concurrent-connection") - { - } + SubscribeAttributeBridgedDeviceBasicVendorID() + : SubscribeAttribute("vendor-id") {} - ~SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() {} + ~SubscribeAttributeBridgedDeviceBasicVendorID() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSupportsConcurrentConnectionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.SupportsConcurrentConnection response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.VendorID response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ProductName */ -class ReadGeneralCommissioningGeneratedCommandList : public ReadAttribute { +class ReadBridgedDeviceBasicProductName : public ReadAttribute { public: - ReadGeneralCommissioningGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } + ReadBridgedDeviceBasicProductName() : ReadAttribute("product-name") {} + + ~ReadBridgedDeviceBasicProductName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductNameWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductName response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic ProductName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicProductName + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicProductName() + : SubscribeAttribute("product-name") {} + + ~SubscribeAttributeBridgedDeviceBasicProductName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductName response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadGeneralCommissioningGeneratedCommandList() {} +/* + * Attribute NodeLabel + */ +class ReadBridgedDeviceBasicNodeLabel : public ReadAttribute { +public: + ReadBridgedDeviceBasicNodeLabel() : ReadAttribute("node-label") {} + + ~ReadBridgedDeviceBasicNodeLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNodeLabelWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.NodeLabel response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic NodeLabel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteBridgedDeviceBasicNodeLabel : public WriteAttribute { +public: + WriteBridgedDeviceBasicNodeLabel() : WriteAttribute("node-label") { + AddArgument("attr-name", "node-label"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBridgedDeviceBasicNodeLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster writeAttributeNodeLabelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BridgedDeviceBasic " + "NodeLabel write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeGeneralCommissioningGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeBridgedDeviceBasicNodeLabel + : public SubscribeAttribute { public: - SubscribeAttributeGeneralCommissioningGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeBridgedDeviceBasicNodeLabel() + : SubscribeAttribute("node-label") {} - ~SubscribeAttributeGeneralCommissioningGeneratedCommandList() {} + ~SubscribeAttributeBridgedDeviceBasicNodeLabel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNodeLabelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.NodeLabel response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute HardwareVersion */ -class ReadGeneralCommissioningAcceptedCommandList : public ReadAttribute { +class ReadBridgedDeviceBasicHardwareVersion : public ReadAttribute { public: - ReadGeneralCommissioningAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadGeneralCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBridgedDeviceBasicHardwareVersion() : ReadAttribute("hardware-version") {} + + ~ReadBridgedDeviceBasicHardwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHardwareVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.HardwareVersion response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic HardwareVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicHardwareVersion + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicHardwareVersion() + : SubscribeAttribute("hardware-version") {} + + ~SubscribeAttributeBridgedDeviceBasicHardwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHardwareVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.HardwareVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeGeneralCommissioningAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeGeneralCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute HardwareVersionString + */ +class ReadBridgedDeviceBasicHardwareVersionString : public ReadAttribute { +public: + ReadBridgedDeviceBasicHardwareVersionString() + : ReadAttribute("hardware-version-string") {} + + ~ReadBridgedDeviceBasicHardwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHardwareVersionStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.HardwareVersionString response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic HardwareVersionString read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicHardwareVersionString + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicHardwareVersionString() + : SubscribeAttribute("hardware-version-string") {} + + ~SubscribeAttributeBridgedDeviceBasicHardwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHardwareVersionStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.HardwareVersionString response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute SoftwareVersion */ -class ReadGeneralCommissioningAttributeList : public ReadAttribute { +class ReadBridgedDeviceBasicSoftwareVersion : public ReadAttribute { public: - ReadGeneralCommissioningAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadGeneralCommissioningAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBridgedDeviceBasicSoftwareVersion() : ReadAttribute("software-version") {} + + ~ReadBridgedDeviceBasicSoftwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSoftwareVersionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SoftwareVersion response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic SoftwareVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicSoftwareVersion + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicSoftwareVersion() + : SubscribeAttribute("software-version") {} + + ~SubscribeAttributeBridgedDeviceBasicSoftwareVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSoftwareVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SoftwareVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningAttributeList : public SubscribeAttribute { +/* + * Attribute SoftwareVersionString + */ +class ReadBridgedDeviceBasicSoftwareVersionString : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningAttributeList() - : SubscribeAttribute("attribute-list") - { - } + ReadBridgedDeviceBasicSoftwareVersionString() + : ReadAttribute("software-version-string") {} + + ~ReadBridgedDeviceBasicSoftwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSoftwareVersionStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SoftwareVersionString response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic SoftwareVersionString read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicSoftwareVersionString + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicSoftwareVersionString() + : SubscribeAttribute("software-version-string") {} + + ~SubscribeAttributeBridgedDeviceBasicSoftwareVersionString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSoftwareVersionStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SoftwareVersionString response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeGeneralCommissioningAttributeList() {} +/* + * Attribute ManufacturingDate + */ +class ReadBridgedDeviceBasicManufacturingDate : public ReadAttribute { +public: + ReadBridgedDeviceBasicManufacturingDate() + : ReadAttribute("manufacturing-date") {} + + ~ReadBridgedDeviceBasicManufacturingDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeManufacturingDateWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ManufacturingDate response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic ManufacturingDate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicManufacturingDate + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicManufacturingDate() + : SubscribeAttribute("manufacturing-date") {} + + ~SubscribeAttributeBridgedDeviceBasicManufacturingDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeManufacturingDateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ManufacturingDate response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute PartNumber + */ +class ReadBridgedDeviceBasicPartNumber : public ReadAttribute { +public: + ReadBridgedDeviceBasicPartNumber() : ReadAttribute("part-number") {} + + ~ReadBridgedDeviceBasicPartNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePartNumberWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.PartNumber response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic PartNumber read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicPartNumber + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicPartNumber() + : SubscribeAttribute("part-number") {} + + ~SubscribeAttributeBridgedDeviceBasicPartNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePartNumberWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.PartNumber response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ProductURL + */ +class ReadBridgedDeviceBasicProductURL : public ReadAttribute { +public: + ReadBridgedDeviceBasicProductURL() : ReadAttribute("product-url") {} + + ~ReadBridgedDeviceBasicProductURL() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductURLWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductURL response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic ProductURL read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicProductURL + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicProductURL() + : SubscribeAttribute("product-url") {} + + ~SubscribeAttributeBridgedDeviceBasicProductURL() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductURLWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductURL response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ProductLabel */ -class ReadGeneralCommissioningFeatureMap : public ReadAttribute { +class ReadBridgedDeviceBasicProductLabel : public ReadAttribute { public: - ReadGeneralCommissioningFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadBridgedDeviceBasicProductLabel() : ReadAttribute("product-label") {} + + ~ReadBridgedDeviceBasicProductLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductLabelWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductLabel response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic ProductLabel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicProductLabel + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicProductLabel() + : SubscribeAttribute("product-label") {} + + ~SubscribeAttributeBridgedDeviceBasicProductLabel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductLabelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ProductLabel response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadGeneralCommissioningFeatureMap() {} +/* + * Attribute SerialNumber + */ +class ReadBridgedDeviceBasicSerialNumber : public ReadAttribute { +public: + ReadBridgedDeviceBasicSerialNumber() : ReadAttribute("serial-number") {} + + ~ReadBridgedDeviceBasicSerialNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSerialNumberWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SerialNumber response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic SerialNumber read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicSerialNumber + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicSerialNumber() + : SubscribeAttribute("serial-number") {} + + ~SubscribeAttributeBridgedDeviceBasicSerialNumber() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSerialNumberWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.SerialNumber response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +/* + * Attribute Reachable + */ +class ReadBridgedDeviceBasicReachable : public ReadAttribute { +public: + ReadBridgedDeviceBasicReachable() : ReadAttribute("reachable") {} + + ~ReadBridgedDeviceBasicReachable() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReachableWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.Reachable response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic Reachable read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicReachable + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicReachable() + : SubscribeAttribute("reachable") {} + + ~SubscribeAttributeBridgedDeviceBasicReachable() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReachableWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.Reachable response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute UniqueID + */ +class ReadBridgedDeviceBasicUniqueID : public ReadAttribute { +public: + ReadBridgedDeviceBasicUniqueID() : ReadAttribute("unique-id") {} + + ~ReadBridgedDeviceBasicUniqueID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUniqueIDWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.UniqueID response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic UniqueID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningFeatureMap : public SubscribeAttribute { +class SubscribeAttributeBridgedDeviceBasicUniqueID : public SubscribeAttribute { public: - SubscribeAttributeGeneralCommissioningFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeBridgedDeviceBasicUniqueID() + : SubscribeAttribute("unique-id") {} - ~SubscribeAttributeGeneralCommissioningFeatureMap() {} + ~SubscribeAttributeBridgedDeviceBasicUniqueID() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUniqueIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.UniqueID response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute GeneratedCommandList */ -class ReadGeneralCommissioningClusterRevision : public ReadAttribute { +class ReadBridgedDeviceBasicGeneratedCommandList : public ReadAttribute { public: - ReadGeneralCommissioningClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadGeneralCommissioningClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("GeneralCommissioning ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBridgedDeviceBasicGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBridgedDeviceBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBridgedDeviceBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralCommissioningClusterRevision : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadBridgedDeviceBasicAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeGeneralCommissioningClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadBridgedDeviceBasicAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBridgedDeviceBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBridgedDeviceBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeGeneralCommissioningClusterRevision() {} +/* + * Attribute AttributeList + */ +class ReadBridgedDeviceBasicAttributeList : public ReadAttribute { +public: + ReadBridgedDeviceBasicAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBridgedDeviceBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeBridgedDeviceBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute FeatureMap + */ +class ReadBridgedDeviceBasicFeatureMap : public ReadAttribute { +public: + ReadBridgedDeviceBasicFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBridgedDeviceBasicFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeBridgedDeviceBasicFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadBridgedDeviceBasicClusterRevision : public ReadAttribute { +public: + ReadBridgedDeviceBasicClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBridgedDeviceBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("BridgedDeviceBasic ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBridgedDeviceBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000039) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BridgedDeviceBasic.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster NetworkCommissioning | 0x0031 | +| Cluster Switch | 0x003B | |------------------------------------------------------------------------------| | Commands: | | -| * ScanNetworks | 0x00 | -| * AddOrUpdateWiFiNetwork | 0x02 | -| * AddOrUpdateThreadNetwork | 0x03 | -| * RemoveNetwork | 0x04 | -| * ConnectNetwork | 0x06 | -| * ReorderNetwork | 0x08 | |------------------------------------------------------------------------------| | Attributes: | | -| * MaxNetworks | 0x0000 | -| * Networks | 0x0001 | -| * ScanMaxTimeSeconds | 0x0002 | -| * ConnectMaxTimeSeconds | 0x0003 | -| * InterfaceEnabled | 0x0004 | -| * LastNetworkingStatus | 0x0005 | -| * LastNetworkID | 0x0006 | -| * LastConnectErrorValue | 0x0007 | +| * NumberOfPositions | 0x0000 | +| * CurrentPosition | 0x0001 | +| * MultiPressMax | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -19800,1305 +37506,2975 @@ class SubscribeAttributeGeneralCommissioningClusterRevision : public SubscribeAt | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * SwitchLatched | 0x0000 | +| * InitialPress | 0x0001 | +| * LongPress | 0x0002 | +| * ShortRelease | 0x0003 | +| * LongRelease | 0x0004 | +| * MultiPressOngoing | 0x0005 | +| * MultiPressComplete | 0x0006 | \*----------------------------------------------------------------------------*/ /* - * Command ScanNetworks + * Attribute NumberOfPositions */ -class NetworkCommissioningScanNetworks : public ClusterCommand { +class ReadSwitchNumberOfPositions : public ReadAttribute { public: - NetworkCommissioningScanNetworks() - : ClusterCommand("scan-networks") - { - AddArgument("Ssid", &mRequest.ssid); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterScanNetworksParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.ssid.HasValue()) { - if (mRequest.ssid.Value().IsNull()) { - params.ssid = nil; - } else { - params.ssid = [NSData dataWithBytes:mRequest.ssid.Value().Value().data() - length:mRequest.ssid.Value().Value().size()]; - } - } else { - params.ssid = nil; - } - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster scanNetworksWithParams:params - completion:^(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Type mRequest; + ReadSwitchNumberOfPositions() : ReadAttribute("number-of-positions") {} + + ~ReadSwitchNumberOfPositions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfPositionsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.NumberOfPositions response %@", [value description]); + if (error != nil) { + LogNSError("Switch NumberOfPositions read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command AddOrUpdateWiFiNetwork - */ -class NetworkCommissioningAddOrUpdateWiFiNetwork : public ClusterCommand { +class SubscribeAttributeSwitchNumberOfPositions : public SubscribeAttribute { public: - NetworkCommissioningAddOrUpdateWiFiNetwork() - : ClusterCommand("add-or-update-wi-fi-network") - { - AddArgument("Ssid", &mRequest.ssid); - AddArgument("Credentials", &mRequest.credentials); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.ssid = [NSData dataWithBytes:mRequest.ssid.data() length:mRequest.ssid.size()]; - params.credentials = [NSData dataWithBytes:mRequest.credentials.data() length:mRequest.credentials.size()]; - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - addOrUpdateWiFiNetworkWithParams:params - completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeSwitchNumberOfPositions() + : SubscribeAttribute("number-of-positions") {} + + ~SubscribeAttributeSwitchNumberOfPositions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfPositionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.NumberOfPositions response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command AddOrUpdateThreadNetwork + * Attribute CurrentPosition */ -class NetworkCommissioningAddOrUpdateThreadNetwork : public ClusterCommand { +class ReadSwitchCurrentPosition : public ReadAttribute { public: - NetworkCommissioningAddOrUpdateThreadNetwork() - : ClusterCommand("add-or-update-thread-network") - { - AddArgument("OperationalDataset", &mRequest.operationalDataset); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.operationalDataset = [NSData dataWithBytes:mRequest.operationalDataset.data() - length:mRequest.operationalDataset.size()]; - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - addOrUpdateThreadNetworkWithParams:params - completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ReadSwitchCurrentPosition() : ReadAttribute("current-position") {} + + ~ReadSwitchCurrentPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.CurrentPosition response %@", [value description]); + if (error != nil) { + LogNSError("Switch CurrentPosition read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSwitchCurrentPosition : public SubscribeAttribute { +public: + SubscribeAttributeSwitchCurrentPosition() + : SubscribeAttribute("current-position") {} + + ~SubscribeAttributeSwitchCurrentPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.CurrentPosition response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command RemoveNetwork + * Attribute MultiPressMax */ -class NetworkCommissioningRemoveNetwork : public ClusterCommand { +class ReadSwitchMultiPressMax : public ReadAttribute { public: - NetworkCommissioningRemoveNetwork() - : ClusterCommand("remove-network") - { - AddArgument("NetworkID", &mRequest.networkID); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterRemoveNetworkParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster removeNetworkWithParams:params - completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ReadSwitchMultiPressMax() : ReadAttribute("multi-press-max") {} + + ~ReadSwitchMultiPressMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMultiPressMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.MultiPressMax response %@", [value description]); + if (error != nil) { + LogNSError("Switch MultiPressMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSwitchMultiPressMax : public SubscribeAttribute { +public: + SubscribeAttributeSwitchMultiPressMax() + : SubscribeAttribute("multi-press-max") {} + + ~SubscribeAttributeSwitchMultiPressMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeMultiPressMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.MultiPressMax response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command ConnectNetwork + * Attribute GeneratedCommandList */ -class NetworkCommissioningConnectNetwork : public ClusterCommand { +class ReadSwitchGeneratedCommandList : public ReadAttribute { public: - NetworkCommissioningConnectNetwork() - : ClusterCommand("connect-network") - { - AddArgument("NetworkID", &mRequest.networkID); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterConnectNetworkParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster connectNetworkWithParams:params - completion:^(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Type mRequest; + ReadSwitchGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadSwitchGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Switch GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command ReorderNetwork - */ -class NetworkCommissioningReorderNetwork : public ClusterCommand { +class SubscribeAttributeSwitchGeneratedCommandList : public SubscribeAttribute { public: - NetworkCommissioningReorderNetwork() - : ClusterCommand("reorder-network") - { - AddArgument("NetworkID", &mRequest.networkID); - AddArgument("NetworkIndex", 0, UINT8_MAX, &mRequest.networkIndex); - AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRNetworkCommissioningClusterReorderNetworkParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; - params.networkIndex = [NSNumber numberWithUnsignedChar:mRequest.networkIndex]; - if (mRequest.breadcrumb.HasValue()) { - params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; - } else { - params.breadcrumb = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster reorderNetworkWithParams:params - completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeSwitchGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeSwitchGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Attribute MaxNetworks + * Attribute AcceptedCommandList */ -class ReadNetworkCommissioningMaxNetworks : public ReadAttribute { +class ReadSwitchAcceptedCommandList : public ReadAttribute { public: - ReadNetworkCommissioningMaxNetworks() - : ReadAttribute("max-networks") - { - } - - ~ReadNetworkCommissioningMaxNetworks() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxNetworksWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.MaxNetworks response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning MaxNetworks read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadSwitchAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadSwitchAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Switch AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningMaxNetworks : public SubscribeAttribute { +class SubscribeAttributeSwitchAcceptedCommandList : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningMaxNetworks() - : SubscribeAttribute("max-networks") - { - } + SubscribeAttributeSwitchAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - ~SubscribeAttributeNetworkCommissioningMaxNetworks() {} + ~SubscribeAttributeSwitchAcceptedCommandList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMaxNetworksWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.MaxNetworks response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Networks + * Attribute AttributeList */ -class ReadNetworkCommissioningNetworks : public ReadAttribute { +class ReadSwitchAttributeList : public ReadAttribute { public: - ReadNetworkCommissioningNetworks() - : ReadAttribute("networks") - { - } - - ~ReadNetworkCommissioningNetworks() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNetworksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.Networks response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning Networks read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadSwitchAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadSwitchAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Switch AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningNetworks : public SubscribeAttribute { +class SubscribeAttributeSwitchAttributeList : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningNetworks() - : SubscribeAttribute("networks") - { - } + SubscribeAttributeSwitchAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeNetworkCommissioningNetworks() {} + ~SubscribeAttributeSwitchAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNetworksWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.Networks response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ScanMaxTimeSeconds + * Attribute FeatureMap */ -class ReadNetworkCommissioningScanMaxTimeSeconds : public ReadAttribute { +class ReadSwitchFeatureMap : public ReadAttribute { public: - ReadNetworkCommissioningScanMaxTimeSeconds() - : ReadAttribute("scan-max-time-seconds") - { - } - - ~ReadNetworkCommissioningScanMaxTimeSeconds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeScanMaxTimeSecondsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning ScanMaxTimeSeconds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadSwitchFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadSwitchFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Switch.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Switch FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds : public SubscribeAttribute { +class SubscribeAttributeSwitchFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() - : SubscribeAttribute("scan-max-time-seconds") - { - } + SubscribeAttributeSwitchFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() {} + ~SubscribeAttributeSwitchFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeScanMaxTimeSecondsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ConnectMaxTimeSeconds + * Attribute ClusterRevision */ -class ReadNetworkCommissioningConnectMaxTimeSeconds : public ReadAttribute { +class ReadSwitchClusterRevision : public ReadAttribute { public: - ReadNetworkCommissioningConnectMaxTimeSeconds() - : ReadAttribute("connect-max-time-seconds") - { - } - - ~ReadNetworkCommissioningConnectMaxTimeSeconds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeConnectMaxTimeSecondsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning ConnectMaxTimeSeconds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadSwitchClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadSwitchClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Switch ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds : public SubscribeAttribute { +class SubscribeAttributeSwitchClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() - : SubscribeAttribute("connect-max-time-seconds") - { - } + SubscribeAttributeSwitchClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() {} + ~SubscribeAttributeSwitchClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterSwitch alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeConnectMaxTimeSecondsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Switch.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster AdministratorCommissioning | 0x003C | +|------------------------------------------------------------------------------| +| Commands: | | +| * OpenCommissioningWindow | 0x00 | +| * OpenBasicCommissioningWindow | 0x01 | +| * RevokeCommissioning | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * WindowStatus | 0x0000 | +| * AdminFabricIndex | 0x0001 | +| * AdminVendorId | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute InterfaceEnabled + * Command OpenCommissioningWindow */ -class ReadNetworkCommissioningInterfaceEnabled : public ReadAttribute { -public: - ReadNetworkCommissioningInterfaceEnabled() - : ReadAttribute("interface-enabled") - { +class AdministratorCommissioningOpenCommissioningWindow + : public ClusterCommand { +public: + AdministratorCommissioningOpenCommissioningWindow() + : ClusterCommand("open-commissioning-window") { + AddArgument("CommissioningTimeout", 0, UINT16_MAX, + &mRequest.commissioningTimeout); + AddArgument("PAKEVerifier", &mRequest.PAKEVerifier); + AddArgument("Discriminator", 0, UINT16_MAX, &mRequest.discriminator); + AddArgument("Iterations", 0, UINT32_MAX, &mRequest.iterations); + AddArgument("Salt", &mRequest.salt); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003C) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAdministratorCommissioningClusterOpenCommissioningWindowParams + alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.commissioningTimeout = + [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; + params.pakeVerifier = [NSData dataWithBytes:mRequest.PAKEVerifier.data() + length:mRequest.PAKEVerifier.size()]; + params.discriminator = + [NSNumber numberWithUnsignedShort:mRequest.discriminator]; + params.iterations = [NSNumber numberWithUnsignedInt:mRequest.iterations]; + params.salt = [NSData dataWithBytes:mRequest.salt.data() + length:mRequest.salt.size()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster openCommissioningWindowWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadNetworkCommissioningInterfaceEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInterfaceEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning InterfaceEnabled read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::AdministratorCommissioning::Commands:: + OpenCommissioningWindow::Type mRequest; }; -class WriteNetworkCommissioningInterfaceEnabled : public WriteAttribute { -public: - WriteNetworkCommissioningInterfaceEnabled() - : WriteAttribute("interface-enabled") - { - AddArgument("attr-name", "interface-enabled"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteNetworkCommissioningInterfaceEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeInterfaceEnabledWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("NetworkCommissioning InterfaceEnabled write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command OpenBasicCommissioningWindow + */ +class AdministratorCommissioningOpenBasicCommissioningWindow + : public ClusterCommand { +public: + AdministratorCommissioningOpenBasicCommissioningWindow() + : ClusterCommand("open-basic-commissioning-window") { + AddArgument("CommissioningTimeout", 0, UINT16_MAX, + &mRequest.commissioningTimeout); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003C) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams + alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.commissioningTimeout = + [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + openBasicCommissioningWindowWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - bool mValue; + chip::app::Clusters::AdministratorCommissioning::Commands:: + OpenBasicCommissioningWindow::Type mRequest; }; -class SubscribeAttributeNetworkCommissioningInterfaceEnabled : public SubscribeAttribute { +/* + * Command RevokeCommissioning + */ +class AdministratorCommissioningRevokeCommissioning : public ClusterCommand { public: - SubscribeAttributeNetworkCommissioningInterfaceEnabled() - : SubscribeAttribute("interface-enabled") - { + AdministratorCommissioningRevokeCommissioning() + : ClusterCommand("revoke-commissioning") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003C) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAdministratorCommissioningClusterRevokeCommissioningParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster revokeCommissioningWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeNetworkCommissioningInterfaceEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInterfaceEnabledWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute LastNetworkingStatus + * Attribute WindowStatus */ -class ReadNetworkCommissioningLastNetworkingStatus : public ReadAttribute { +class ReadAdministratorCommissioningWindowStatus : public ReadAttribute { public: - ReadNetworkCommissioningLastNetworkingStatus() - : ReadAttribute("last-networking-status") - { - } - - ~ReadNetworkCommissioningLastNetworkingStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLastNetworkingStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning LastNetworkingStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAdministratorCommissioningWindowStatus() + : ReadAttribute("window-status") {} + + ~ReadAdministratorCommissioningWindowStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWindowStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.WindowStatus response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning WindowStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningWindowStatus + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningWindowStatus() + : SubscribeAttribute("window-status") {} + + ~SubscribeAttributeAdministratorCommissioningWindowStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWindowStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.WindowStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningLastNetworkingStatus : public SubscribeAttribute { +/* + * Attribute AdminFabricIndex + */ +class ReadAdministratorCommissioningAdminFabricIndex : public ReadAttribute { public: - SubscribeAttributeNetworkCommissioningLastNetworkingStatus() - : SubscribeAttribute("last-networking-status") - { - } - - ~SubscribeAttributeNetworkCommissioningLastNetworkingStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLastNetworkingStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadAdministratorCommissioningAdminFabricIndex() + : ReadAttribute("admin-fabric-index") {} + + ~ReadAdministratorCommissioningAdminFabricIndex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAdminFabricIndexWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning AdminFabricIndex read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningAdminFabricIndex + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningAdminFabricIndex() + : SubscribeAttribute("admin-fabric-index") {} + + ~SubscribeAttributeAdministratorCommissioningAdminFabricIndex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAdminFabricIndexWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LastNetworkID + * Attribute AdminVendorId */ -class ReadNetworkCommissioningLastNetworkID : public ReadAttribute { +class ReadAdministratorCommissioningAdminVendorId : public ReadAttribute { public: - ReadNetworkCommissioningLastNetworkID() - : ReadAttribute("last-network-id") - { - } - - ~ReadNetworkCommissioningLastNetworkID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000006) on endpoint %u", endpointId); + ReadAdministratorCommissioningAdminVendorId() + : ReadAttribute("admin-vendor-id") {} + + ~ReadAdministratorCommissioningAdminVendorId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAdminVendorIdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AdminVendorId response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning AdminVendorId read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningAdminVendorId + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningAdminVendorId() + : SubscribeAttribute("admin-vendor-id") {} + + ~SubscribeAttributeAdministratorCommissioningAdminVendorId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAdminVendorIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AdminVendorId response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLastNetworkIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastNetworkID response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning LastNetworkID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadAdministratorCommissioningGeneratedCommandList + : public ReadAttribute { +public: + ReadAdministratorCommissioningGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadAdministratorCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeAdministratorCommissioningGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningLastNetworkID : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadAdministratorCommissioningAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeNetworkCommissioningLastNetworkID() - : SubscribeAttribute("last-network-id") - { - } - - ~SubscribeAttributeNetworkCommissioningLastNetworkID() {} + ReadAdministratorCommissioningAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadAdministratorCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeAdministratorCommissioningAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLastNetworkIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastNetworkID response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadAdministratorCommissioningAttributeList : public ReadAttribute { +public: + ReadAdministratorCommissioningAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadAdministratorCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeAdministratorCommissioningAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LastConnectErrorValue + * Attribute FeatureMap */ -class ReadNetworkCommissioningLastConnectErrorValue : public ReadAttribute { +class ReadAdministratorCommissioningFeatureMap : public ReadAttribute { public: - ReadNetworkCommissioningLastConnectErrorValue() - : ReadAttribute("last-connect-error-value") - { - } + ReadAdministratorCommissioningFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadAdministratorCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeAdministratorCommissioningFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadNetworkCommissioningLastConnectErrorValue() {} +/* + * Attribute ClusterRevision + */ +class ReadAdministratorCommissioningClusterRevision : public ReadAttribute { +public: + ReadAdministratorCommissioningClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadAdministratorCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("AdministratorCommissioning ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAdministratorCommissioningClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeAdministratorCommissioningClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeAdministratorCommissioningClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterAdministratorCommissioning alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AdministratorCommissioning.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x00000007) on endpoint %u", endpointId); +/*----------------------------------------------------------------------------*\ +| Cluster OperationalCredentials | 0x003E | +|------------------------------------------------------------------------------| +| Commands: | | +| * AttestationRequest | 0x00 | +| * CertificateChainRequest | 0x02 | +| * CSRRequest | 0x04 | +| * AddNOC | 0x06 | +| * UpdateNOC | 0x07 | +| * UpdateFabricLabel | 0x09 | +| * RemoveFabric | 0x0A | +| * AddTrustedRootCertificate | 0x0B | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NOCs | 0x0000 | +| * Fabrics | 0x0001 | +| * SupportedFabrics | 0x0002 | +| * CommissionedFabrics | 0x0003 | +| * TrustedRootCertificates | 0x0004 | +| * CurrentFabricIndex | 0x0005 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLastConnectErrorValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning LastConnectErrorValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command AttestationRequest + */ +class OperationalCredentialsAttestationRequest : public ClusterCommand { +public: + OperationalCredentialsAttestationRequest() + : ClusterCommand("attestation-request") { + AddArgument("AttestationNonce", &mRequest.attestationNonce); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterAttestationRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.attestationNonce = + [NSData dataWithBytes:mRequest.attestationNonce.data() + length:mRequest.attestationNonce.size()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + attestationRequestWithParams:params + completion:^( + MTROperationalCredentialsClusterAttestationResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest:: + Type mRequest; }; -class SubscribeAttributeNetworkCommissioningLastConnectErrorValue : public SubscribeAttribute { +/* + * Command CertificateChainRequest + */ +class OperationalCredentialsCertificateChainRequest : public ClusterCommand { public: - SubscribeAttributeNetworkCommissioningLastConnectErrorValue() - : SubscribeAttribute("last-connect-error-value") - { + OperationalCredentialsCertificateChainRequest() + : ClusterCommand("certificate-chain-request") { + AddArgument("CertificateType", 0, UINT8_MAX, &mRequest.certificateType); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterCertificateChainRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.certificateType = + [NSNumber numberWithUnsignedChar:mRequest.certificateType]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + certificateChainRequestWithParams:params + completion:^( + MTROperationalCredentialsClusterCertificateChainResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeNetworkCommissioningLastConnectErrorValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLastConnectErrorValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OperationalCredentials::Commands:: + CertificateChainRequest::Type mRequest; }; /* - * Attribute GeneratedCommandList + * Command CSRRequest */ -class ReadNetworkCommissioningGeneratedCommandList : public ReadAttribute { +class OperationalCredentialsCSRRequest : public ClusterCommand { public: - ReadNetworkCommissioningGeneratedCommandList() - : ReadAttribute("generated-command-list") - { + OperationalCredentialsCSRRequest() : ClusterCommand("csrrequest") { + AddArgument("CSRNonce", &mRequest.CSRNonce); + AddArgument("IsForUpdateNOC", 0, 1, &mRequest.isForUpdateNOC); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterCSRRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.csrNonce = [NSData dataWithBytes:mRequest.CSRNonce.data() + length:mRequest.CSRNonce.size()]; + if (mRequest.isForUpdateNOC.HasValue()) { + params.isForUpdateNOC = + [NSNumber numberWithBool:mRequest.isForUpdateNOC.Value()]; + } else { + params.isForUpdateNOC = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster CSRRequestWithParams:params + completion:^( + MTROperationalCredentialsClusterCSRResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadNetworkCommissioningGeneratedCommandList() {} +private: + chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Type + mRequest; +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +/* + * Command AddNOC + */ +class OperationalCredentialsAddNOC : public ClusterCommand { +public: + OperationalCredentialsAddNOC() : ClusterCommand("add-noc") { + AddArgument("NOCValue", &mRequest.NOCValue); + AddArgument("ICACValue", &mRequest.ICACValue); + AddArgument("IPKValue", &mRequest.IPKValue); + AddArgument("CaseAdminSubject", 0, UINT64_MAX, &mRequest.caseAdminSubject); + AddArgument("AdminVendorId", 0, UINT16_MAX, &mRequest.adminVendorId); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterAddNOCParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() + length:mRequest.NOCValue.size()]; + if (mRequest.ICACValue.HasValue()) { + params.icacValue = + [NSData dataWithBytes:mRequest.ICACValue.Value().data() + length:mRequest.ICACValue.Value().size()]; + } else { + params.icacValue = nil; + } + params.ipkValue = [NSData dataWithBytes:mRequest.IPKValue.data() + length:mRequest.IPKValue.size()]; + params.caseAdminSubject = + [NSNumber numberWithUnsignedLongLong:mRequest.caseAdminSubject]; + params.adminVendorId = [NSNumber + numberWithUnsignedShort:chip::to_underlying(mRequest.adminVendorId)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + addNOCWithParams:params + completion:^(MTROperationalCredentialsClusterNOCResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type mRequest; }; -class SubscribeAttributeNetworkCommissioningGeneratedCommandList : public SubscribeAttribute { +/* + * Command UpdateNOC + */ +class OperationalCredentialsUpdateNOC : public ClusterCommand { public: - SubscribeAttributeNetworkCommissioningGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + OperationalCredentialsUpdateNOC() : ClusterCommand("update-noc") { + AddArgument("NOCValue", &mRequest.NOCValue); + AddArgument("ICACValue", &mRequest.ICACValue); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterUpdateNOCParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() + length:mRequest.NOCValue.size()]; + if (mRequest.ICACValue.HasValue()) { + params.icacValue = + [NSData dataWithBytes:mRequest.ICACValue.Value().data() + length:mRequest.ICACValue.Value().size()]; + } else { + params.icacValue = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster updateNOCWithParams:params + completion:^( + MTROperationalCredentialsClusterNOCResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeNetworkCommissioningGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type + mRequest; }; /* - * Attribute AcceptedCommandList + * Command UpdateFabricLabel */ -class ReadNetworkCommissioningAcceptedCommandList : public ReadAttribute { +class OperationalCredentialsUpdateFabricLabel : public ClusterCommand { public: - ReadNetworkCommissioningAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + OperationalCredentialsUpdateFabricLabel() + : ClusterCommand("update-fabric-label") { + AddArgument("Label", &mRequest.label); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x00000009) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterUpdateFabricLabelParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.label = [[NSString alloc] initWithBytes:mRequest.label.data() + length:mRequest.label.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + updateFabricLabelWithParams:params + completion:^( + MTROperationalCredentialsClusterNOCResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadNetworkCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type + mRequest; }; -class SubscribeAttributeNetworkCommissioningAcceptedCommandList : public SubscribeAttribute { +/* + * Command RemoveFabric + */ +class OperationalCredentialsRemoveFabric : public ClusterCommand { public: - SubscribeAttributeNetworkCommissioningAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { + OperationalCredentialsRemoveFabric() : ClusterCommand("remove-fabric") { + AddArgument("FabricIndex", 0, UINT8_MAX, &mRequest.fabricIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x0000000A) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.fabricIndex = [NSNumber numberWithUnsignedChar:mRequest.fabricIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeFabricWithParams:params + completion:^( + MTROperationalCredentialsClusterNOCResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeNetworkCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type + mRequest; }; /* - * Attribute AttributeList + * Command AddTrustedRootCertificate */ -class ReadNetworkCommissioningAttributeList : public ReadAttribute { +class OperationalCredentialsAddTrustedRootCertificate : public ClusterCommand { public: - ReadNetworkCommissioningAttributeList() - : ReadAttribute("attribute-list") - { + OperationalCredentialsAddTrustedRootCertificate() + : ClusterCommand("add-trusted-root-certificate") { + AddArgument("RootCertificate", &mRequest.rootCertificate); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003E) command (0x0000000B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTROperationalCredentialsClusterAddTrustedRootCertificateParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.rootCertificate = + [NSData dataWithBytes:mRequest.rootCertificate.data() + length:mRequest.rootCertificate.size()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster addTrustedRootCertificateWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadNetworkCommissioningAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +private: + chip::app::Clusters::OperationalCredentials::Commands:: + AddTrustedRootCertificate::Type mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute NOCs + */ +class ReadOperationalCredentialsNOCs : public ReadAttribute { +public: + ReadOperationalCredentialsNOCs() : ReadAttribute("nocs") {} + + ~ReadOperationalCredentialsNOCs() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeNOCsWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OperationalCredentials.NOCs response %@", + [value description]); + if (error != nil) { + LogNSError( + "OperationalCredentials NOCs read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningAttributeList : public SubscribeAttribute { +class SubscribeAttributeOperationalCredentialsNOCs : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeOperationalCredentialsNOCs() : SubscribeAttribute("nocs") {} - ~SubscribeAttributeNetworkCommissioningAttributeList() {} + ~SubscribeAttributeOperationalCredentialsNOCs() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNOCsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.NOCs response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute Fabrics */ -class ReadNetworkCommissioningFeatureMap : public ReadAttribute { +class ReadOperationalCredentialsFabrics : public ReadAttribute { public: - ReadNetworkCommissioningFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadNetworkCommissioningFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOperationalCredentialsFabrics() : ReadAttribute("fabrics") {} + + ~ReadOperationalCredentialsFabrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeFabricsWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog( + @"OperationalCredentials.Fabrics response %@", + [value description]); + if (error != nil) { + LogNSError( + "OperationalCredentials Fabrics read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningFeatureMap : public SubscribeAttribute { +class SubscribeAttributeOperationalCredentialsFabrics + : public SubscribeAttribute { public: - SubscribeAttributeNetworkCommissioningFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeOperationalCredentialsFabrics() + : SubscribeAttribute("fabrics") {} - ~SubscribeAttributeNetworkCommissioningFeatureMap() {} + ~SubscribeAttributeOperationalCredentialsFabrics() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFabricsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.Fabrics response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute SupportedFabrics */ -class ReadNetworkCommissioningClusterRevision : public ReadAttribute { +class ReadOperationalCredentialsSupportedFabrics : public ReadAttribute { public: - ReadNetworkCommissioningClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadNetworkCommissioningClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("NetworkCommissioning ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOperationalCredentialsSupportedFabrics() + : ReadAttribute("supported-fabrics") {} + + ~ReadOperationalCredentialsSupportedFabrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedFabricsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.SupportedFabrics response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials SupportedFabrics read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsSupportedFabrics + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsSupportedFabrics() + : SubscribeAttribute("supported-fabrics") {} + + ~SubscribeAttributeOperationalCredentialsSupportedFabrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedFabricsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.SupportedFabrics response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeNetworkCommissioningClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeNetworkCommissioningClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } +/* + * Attribute CommissionedFabrics + */ +class ReadOperationalCredentialsCommissionedFabrics : public ReadAttribute { +public: + ReadOperationalCredentialsCommissionedFabrics() + : ReadAttribute("commissioned-fabrics") {} + + ~ReadOperationalCredentialsCommissionedFabrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCommissionedFabricsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.CommissionedFabrics response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials CommissionedFabrics read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsCommissionedFabrics + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsCommissionedFabrics() + : SubscribeAttribute("commissioned-fabrics") {} + + ~SubscribeAttributeOperationalCredentialsCommissionedFabrics() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCommissionedFabricsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.CommissionedFabrics response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeNetworkCommissioningClusterRevision() {} +/* + * Attribute TrustedRootCertificates + */ +class ReadOperationalCredentialsTrustedRootCertificates : public ReadAttribute { +public: + ReadOperationalCredentialsTrustedRootCertificates() + : ReadAttribute("trusted-root-certificates") {} + + ~ReadOperationalCredentialsTrustedRootCertificates() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTrustedRootCertificatesWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials TrustedRootCertificates read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsTrustedRootCertificates + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsTrustedRootCertificates() + : SubscribeAttribute("trusted-root-certificates") {} + + ~SubscribeAttributeOperationalCredentialsTrustedRootCertificates() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTrustedRootCertificatesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000031) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"NetworkCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute CurrentFabricIndex + */ +class ReadOperationalCredentialsCurrentFabricIndex : public ReadAttribute { +public: + ReadOperationalCredentialsCurrentFabricIndex() + : ReadAttribute("current-fabric-index") {} + + ~ReadOperationalCredentialsCurrentFabricIndex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentFabricIndexWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials CurrentFabricIndex read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsCurrentFabricIndex + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsCurrentFabricIndex() + : SubscribeAttribute("current-fabric-index") {} + + ~SubscribeAttributeOperationalCredentialsCurrentFabricIndex() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentFabricIndexWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadOperationalCredentialsGeneratedCommandList : public ReadAttribute { +public: + ReadOperationalCredentialsGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadOperationalCredentialsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeOperationalCredentialsGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AcceptedCommandList + */ +class ReadOperationalCredentialsAcceptedCommandList : public ReadAttribute { +public: + ReadOperationalCredentialsAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadOperationalCredentialsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeOperationalCredentialsAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AttributeList + */ +class ReadOperationalCredentialsAttributeList : public ReadAttribute { +public: + ReadOperationalCredentialsAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadOperationalCredentialsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeOperationalCredentialsAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute FeatureMap + */ +class ReadOperationalCredentialsFeatureMap : public ReadAttribute { +public: + ReadOperationalCredentialsFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOperationalCredentialsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OperationalCredentials.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeOperationalCredentialsFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadOperationalCredentialsClusterRevision : public ReadAttribute { +public: + ReadOperationalCredentialsClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadOperationalCredentialsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("OperationalCredentials ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOperationalCredentialsClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeOperationalCredentialsClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeOperationalCredentialsClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterOperationalCredentials alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OperationalCredentials.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster DiagnosticLogs | 0x0032 | +| Cluster GroupKeyManagement | 0x003F | |------------------------------------------------------------------------------| | Commands: | | -| * RetrieveLogsRequest | 0x00 | +| * KeySetWrite | 0x00 | +| * KeySetRead | 0x01 | +| * KeySetRemove | 0x03 | +| * KeySetReadAllIndices | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | +| * GroupKeyMap | 0x0000 | +| * GroupTable | 0x0001 | +| * MaxGroupsPerFabric | 0x0002 | +| * MaxGroupKeysPerFabric | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -21109,424 +40485,1125 @@ class SubscribeAttributeNetworkCommissioningClusterRevision : public SubscribeAt \*----------------------------------------------------------------------------*/ /* - * Command RetrieveLogsRequest + * Command KeySetWrite */ -class DiagnosticLogsRetrieveLogsRequest : public ClusterCommand { +class GroupKeyManagementKeySetWrite : public ClusterCommand { public: - DiagnosticLogsRetrieveLogsRequest() - : ClusterCommand("retrieve-logs-request") - { - AddArgument("Intent", 0, UINT8_MAX, &mRequest.intent); - AddArgument("RequestedProtocol", 0, UINT8_MAX, &mRequest.requestedProtocol); - AddArgument("TransferFileDesignator", &mRequest.transferFileDesignator); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRDiagnosticLogsClusterRetrieveLogsRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.intent = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.intent)]; - params.requestedProtocol = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.requestedProtocol)]; - params.transferFileDesignator = [NSData dataWithBytes:mRequest.transferFileDesignator.data() - length:mRequest.transferFileDesignator.size()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster retrieveLogsRequestWithParams:params - completion:^(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + GroupKeyManagementKeySetWrite() + : ClusterCommand("key-set-write"), + mComplex_GroupKeySet(&mRequest.groupKeySet) { + AddArgument("GroupKeySet", &mComplex_GroupKeySet); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003F) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupKeySet = [MTRGroupKeyManagementClusterGroupKeySetStruct new]; + params.groupKeySet.groupKeySetID = + [NSNumber numberWithUnsignedShort:mRequest.groupKeySet.groupKeySetID]; + params.groupKeySet.groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.groupKeySet + .groupKeySecurityPolicy)]; + if (mRequest.groupKeySet.epochKey0.IsNull()) { + params.groupKeySet.epochKey0 = nil; + } else { + params.groupKeySet.epochKey0 = + [NSData dataWithBytes:mRequest.groupKeySet.epochKey0.Value().data() + length:mRequest.groupKeySet.epochKey0.Value().size()]; + } + if (mRequest.groupKeySet.epochStartTime0.IsNull()) { + params.groupKeySet.epochStartTime0 = nil; + } else { + params.groupKeySet.epochStartTime0 = + [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet + .epochStartTime0.Value()]; + } + if (mRequest.groupKeySet.epochKey1.IsNull()) { + params.groupKeySet.epochKey1 = nil; + } else { + params.groupKeySet.epochKey1 = + [NSData dataWithBytes:mRequest.groupKeySet.epochKey1.Value().data() + length:mRequest.groupKeySet.epochKey1.Value().size()]; + } + if (mRequest.groupKeySet.epochStartTime1.IsNull()) { + params.groupKeySet.epochStartTime1 = nil; + } else { + params.groupKeySet.epochStartTime1 = + [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet + .epochStartTime1.Value()]; + } + if (mRequest.groupKeySet.epochKey2.IsNull()) { + params.groupKeySet.epochKey2 = nil; + } else { + params.groupKeySet.epochKey2 = + [NSData dataWithBytes:mRequest.groupKeySet.epochKey2.Value().data() + length:mRequest.groupKeySet.epochKey2.Value().size()]; + } + if (mRequest.groupKeySet.epochStartTime2.IsNull()) { + params.groupKeySet.epochStartTime2 = nil; + } else { + params.groupKeySet.epochStartTime2 = + [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet + .epochStartTime2.Value()]; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster keySetWriteWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type mRequest; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::Type> + mComplex_GroupKeySet; }; /* - * Attribute GeneratedCommandList + * Command KeySetRead */ -class ReadDiagnosticLogsGeneratedCommandList : public ReadAttribute { +class GroupKeyManagementKeySetRead : public ClusterCommand { public: - ReadDiagnosticLogsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadDiagnosticLogsGeneratedCommandList() {} + GroupKeyManagementKeySetRead() : ClusterCommand("key-set-read") { + AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003F) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupKeyManagementClusterKeySetReadParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupKeySetID = + [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + keySetReadWithParams:params + completion:^( + MTRGroupKeyManagementClusterKeySetReadResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("DiagnosticLogs GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type mRequest; }; -class SubscribeAttributeDiagnosticLogsGeneratedCommandList : public SubscribeAttribute { +/* + * Command KeySetRemove + */ +class GroupKeyManagementKeySetRemove : public ClusterCommand { public: - SubscribeAttributeDiagnosticLogsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + GroupKeyManagementKeySetRemove() : ClusterCommand("key-set-remove") { + AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003F) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupKeyManagementClusterKeySetRemoveParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.groupKeySetID = + [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster keySetRemoveWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeDiagnosticLogsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type + mRequest; }; /* - * Attribute AcceptedCommandList + * Command KeySetReadAllIndices */ -class ReadDiagnosticLogsAcceptedCommandList : public ReadAttribute { +class GroupKeyManagementKeySetReadAllIndices : public ClusterCommand { public: - ReadDiagnosticLogsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + GroupKeyManagementKeySetReadAllIndices() + : ClusterCommand("key-set-read-all-indices"), + mComplex_GroupKeySetIDs(&mRequest.groupKeySetIDs) { + AddArgument("GroupKeySetIDs", &mComplex_GroupKeySetIDs); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000003F) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRGroupKeyManagementClusterKeySetReadAllIndicesParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.groupKeySetIDs) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + params.groupKeySetIDs = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + keySetReadAllIndicesWithParams:params + completion:^( + MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadDiagnosticLogsAcceptedCommandList() {} +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type + mRequest; + TypedComplexArgument> + mComplex_GroupKeySetIDs; +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +/* + * Attribute GroupKeyMap + */ +class ReadGroupKeyManagementGroupKeyMap : public ReadAttribute { +public: + ReadGroupKeyManagementGroupKeyMap() : ReadAttribute("group-key-map") {} + + ~ReadGroupKeyManagementGroupKeyMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeGroupKeyMapWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GroupKeyMap " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement " + "GroupKeyMap read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("DiagnosticLogs AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class WriteGroupKeyManagementGroupKeyMap : public WriteAttribute { +public: + WriteGroupKeyManagementGroupKeyMap() + : WriteAttribute("group-key-map"), mComplex(&mValue) { + AddArgument("attr-name", "group-key-map"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteGroupKeyManagementGroupKeyMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRGroupKeyManagementClusterGroupKeyMapStruct *newElement_0; + newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; + newElement_0.groupId = + [NSNumber numberWithUnsignedShort:entry_0.groupId]; + newElement_0.groupKeySetID = + [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster writeAttributeGroupKeyMapWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("GroupKeyManagement " + "GroupKeyMap write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::List + mValue; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex; }; -class SubscribeAttributeDiagnosticLogsAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeGroupKeyManagementGroupKeyMap + : public SubscribeAttribute { public: - SubscribeAttributeDiagnosticLogsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeGroupKeyManagementGroupKeyMap() + : SubscribeAttribute("group-key-map") {} - ~SubscribeAttributeDiagnosticLogsAcceptedCommandList() {} + ~SubscribeAttributeGroupKeyManagementGroupKeyMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGroupKeyMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GroupKeyMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute GroupTable */ -class ReadDiagnosticLogsAttributeList : public ReadAttribute { +class ReadGroupKeyManagementGroupTable : public ReadAttribute { public: - ReadDiagnosticLogsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadDiagnosticLogsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("DiagnosticLogs AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupKeyManagementGroupTable() : ReadAttribute("group-table") {} + + ~ReadGroupKeyManagementGroupTable() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeGroupTableWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GroupTable " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement " + "GroupTable read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDiagnosticLogsAttributeList : public SubscribeAttribute { +class SubscribeAttributeGroupKeyManagementGroupTable + : public SubscribeAttribute { public: - SubscribeAttributeDiagnosticLogsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeGroupKeyManagementGroupTable() + : SubscribeAttribute("group-table") {} - ~SubscribeAttributeDiagnosticLogsAttributeList() {} + ~SubscribeAttributeGroupKeyManagementGroupTable() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGroupTableWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GroupTable response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute MaxGroupsPerFabric */ -class ReadDiagnosticLogsFeatureMap : public ReadAttribute { +class ReadGroupKeyManagementMaxGroupsPerFabric : public ReadAttribute { public: - ReadDiagnosticLogsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadDiagnosticLogsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("DiagnosticLogs FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadGroupKeyManagementMaxGroupsPerFabric() + : ReadAttribute("max-groups-per-fabric") {} + + ~ReadGroupKeyManagementMaxGroupsPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxGroupsPerFabricWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement MaxGroupsPerFabric read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() + : SubscribeAttribute("max-groups-per-fabric") {} + + ~SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxGroupsPerFabricWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDiagnosticLogsFeatureMap : public SubscribeAttribute { +/* + * Attribute MaxGroupKeysPerFabric + */ +class ReadGroupKeyManagementMaxGroupKeysPerFabric : public ReadAttribute { public: - SubscribeAttributeDiagnosticLogsFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeDiagnosticLogsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadGroupKeyManagementMaxGroupKeysPerFabric() + : ReadAttribute("max-group-keys-per-fabric") {} + + ~ReadGroupKeyManagementMaxGroupKeysPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxGroupKeysPerFabricWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement MaxGroupKeysPerFabric read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() + : SubscribeAttribute("max-group-keys-per-fabric") {} + + ~SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxGroupKeysPerFabricWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute GeneratedCommandList */ -class ReadDiagnosticLogsClusterRevision : public ReadAttribute { +class ReadGroupKeyManagementGeneratedCommandList : public ReadAttribute { public: - ReadDiagnosticLogsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadDiagnosticLogsClusterRevision() {} + ReadGroupKeyManagementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadGroupKeyManagementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeGroupKeyManagementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +/* + * Attribute AcceptedCommandList + */ +class ReadGroupKeyManagementAcceptedCommandList : public ReadAttribute { +public: + ReadGroupKeyManagementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadGroupKeyManagementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeGroupKeyManagementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("DiagnosticLogs ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadGroupKeyManagementAttributeList : public ReadAttribute { +public: + ReadGroupKeyManagementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadGroupKeyManagementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeGroupKeyManagementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDiagnosticLogsClusterRevision : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadGroupKeyManagementFeatureMap : public ReadAttribute { public: - SubscribeAttributeDiagnosticLogsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + ReadGroupKeyManagementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadGroupKeyManagementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeGroupKeyManagementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeDiagnosticLogsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000032) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DiagnosticLogs.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/* + * Attribute ClusterRevision + */ +class ReadGroupKeyManagementClusterRevision : public ReadAttribute { +public: + ReadGroupKeyManagementClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadGroupKeyManagementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("GroupKeyManagement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeGroupKeyManagementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeGroupKeyManagementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeGroupKeyManagementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"GroupKeyManagement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; /*----------------------------------------------------------------------------*\ -| Cluster GeneralDiagnostics | 0x0033 | +| Cluster FixedLabel | 0x0040 | |------------------------------------------------------------------------------| | Commands: | | -| * TestEventTrigger | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * NetworkInterfaces | 0x0000 | -| * RebootCount | 0x0001 | -| * UpTime | 0x0002 | -| * TotalOperationalHours | 0x0003 | -| * BootReasons | 0x0004 | -| * ActiveHardwareFaults | 0x0005 | -| * ActiveRadioFaults | 0x0006 | -| * ActiveNetworkFaults | 0x0007 | -| * TestEventTriggersEnabled | 0x0008 | +| * LabelList | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -21534,1051 +41611,1550 @@ class SubscribeAttributeDiagnosticLogsClusterRevision : public SubscribeAttribut | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * HardwareFaultChange | 0x0000 | -| * RadioFaultChange | 0x0001 | -| * NetworkFaultChange | 0x0002 | -| * BootReason | 0x0003 | \*----------------------------------------------------------------------------*/ /* - * Command TestEventTrigger + * Attribute LabelList */ -class GeneralDiagnosticsTestEventTrigger : public ClusterCommand { +class ReadFixedLabelLabelList : public ReadAttribute { public: - GeneralDiagnosticsTestEventTrigger() - : ClusterCommand("test-event-trigger") - { - AddArgument("EnableKey", &mRequest.enableKey); - AddArgument("EventTrigger", 0, UINT64_MAX, &mRequest.eventTrigger); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.enableKey = [NSData dataWithBytes:mRequest.enableKey.data() length:mRequest.enableKey.size()]; - params.eventTrigger = [NSNumber numberWithUnsignedLongLong:mRequest.eventTrigger]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testEventTriggerWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type mRequest; + ReadFixedLabelLabelList() : ReadAttribute("label-list") {} + + ~ReadFixedLabelLabelList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLabelListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FixedLabel.LabelList response %@", [value description]); + if (error != nil) { + LogNSError("FixedLabel LabelList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Attribute NetworkInterfaces - */ -class ReadGeneralDiagnosticsNetworkInterfaces : public ReadAttribute { +class SubscribeAttributeFixedLabelLabelList : public SubscribeAttribute { public: - ReadGeneralDiagnosticsNetworkInterfaces() - : ReadAttribute("network-interfaces") - { - } - - ~ReadGeneralDiagnosticsNetworkInterfaces() {} + SubscribeAttributeFixedLabelLabelList() : SubscribeAttribute("label-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000000) on endpoint %u", endpointId); + ~SubscribeAttributeFixedLabelLabelList() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics NetworkInterfaces read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeGeneralDiagnosticsNetworkInterfaces : public SubscribeAttribute { -public: - SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() - : SubscribeAttribute("network-interfaces") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLabelListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNetworkInterfacesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.LabelList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RebootCount + * Attribute GeneratedCommandList */ -class ReadGeneralDiagnosticsRebootCount : public ReadAttribute { +class ReadFixedLabelGeneratedCommandList : public ReadAttribute { public: - ReadGeneralDiagnosticsRebootCount() - : ReadAttribute("reboot-count") - { - } - - ~ReadGeneralDiagnosticsRebootCount() {} + ReadFixedLabelGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadFixedLabelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("FixedLabel GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFixedLabelGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFixedLabelGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeFixedLabelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000001) on endpoint %u", endpointId); +/* + * Attribute AcceptedCommandList + */ +class ReadFixedLabelAcceptedCommandList : public ReadAttribute { +public: + ReadFixedLabelAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadFixedLabelAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("FixedLabel AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFixedLabelAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFixedLabelAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeFixedLabelAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics RebootCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadFixedLabelAttributeList : public ReadAttribute { +public: + ReadFixedLabelAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadFixedLabelAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("FixedLabel AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsRebootCount : public SubscribeAttribute { +class SubscribeAttributeFixedLabelAttributeList : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsRebootCount() - : SubscribeAttribute("reboot-count") - { - } + SubscribeAttributeFixedLabelAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeGeneralDiagnosticsRebootCount() {} + ~SubscribeAttributeFixedLabelAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRebootCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute UpTime + * Attribute FeatureMap */ -class ReadGeneralDiagnosticsUpTime : public ReadAttribute { +class ReadFixedLabelFeatureMap : public ReadAttribute { public: - ReadGeneralDiagnosticsUpTime() - : ReadAttribute("up-time") - { - } - - ~ReadGeneralDiagnosticsUpTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics UpTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFixedLabelFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadFixedLabelFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FixedLabel.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("FixedLabel FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsUpTime : public SubscribeAttribute { +class SubscribeAttributeFixedLabelFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsUpTime() - : SubscribeAttribute("up-time") - { - } + SubscribeAttributeFixedLabelFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeGeneralDiagnosticsUpTime() {} + ~SubscribeAttributeFixedLabelFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeUpTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TotalOperationalHours + * Attribute ClusterRevision */ -class ReadGeneralDiagnosticsTotalOperationalHours : public ReadAttribute { +class ReadFixedLabelClusterRevision : public ReadAttribute { public: - ReadGeneralDiagnosticsTotalOperationalHours() - : ReadAttribute("total-operational-hours") - { - } - - ~ReadGeneralDiagnosticsTotalOperationalHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics TotalOperationalHours read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFixedLabelClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadFixedLabelClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("FixedLabel ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsTotalOperationalHours : public SubscribeAttribute { +class SubscribeAttributeFixedLabelClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() - : SubscribeAttribute("total-operational-hours") - { - } + SubscribeAttributeFixedLabelClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() {} + ~SubscribeAttributeFixedLabelClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000040) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFixedLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTotalOperationalHoursWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster UserLabel | 0x0041 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * LabelList | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute BootReasons + * Attribute LabelList */ -class ReadGeneralDiagnosticsBootReasons : public ReadAttribute { +class ReadUserLabelLabelList : public ReadAttribute { public: - ReadGeneralDiagnosticsBootReasons() - : ReadAttribute("boot-reasons") - { - } - - ~ReadGeneralDiagnosticsBootReasons() {} + ReadUserLabelLabelList() : ReadAttribute("label-list") {} + + ~ReadUserLabelLabelList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLabelListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UserLabel.LabelList response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel LabelList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000004) on endpoint %u", endpointId); +class WriteUserLabelLabelList : public WriteAttribute { +public: + WriteUserLabelLabelList() : WriteAttribute("label-list"), mComplex(&mValue) { + AddArgument("attr-name", "label-list"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUserLabelLabelList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRUserLabelClusterLabelStruct *newElement_0; + newElement_0 = [MTRUserLabelClusterLabelStruct new]; + newElement_0.label = + [[NSString alloc] initWithBytes:entry_0.label.data() + length:entry_0.label.size() + encoding:NSUTF8StringEncoding]; + newElement_0.value = + [[NSString alloc] initWithBytes:entry_0.value.data() + length:entry_0.value.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeLabelListWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UserLabel LabelList write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBootReasonsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.BootReasons response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics BootReasons read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::DataModel::List< + const chip::app::Clusters::UserLabel::Structs::LabelStruct::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeGeneralDiagnosticsBootReasons : public SubscribeAttribute { +class SubscribeAttributeUserLabelLabelList : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsBootReasons() - : SubscribeAttribute("boot-reasons") - { - } + SubscribeAttributeUserLabelLabelList() : SubscribeAttribute("label-list") {} - ~SubscribeAttributeGeneralDiagnosticsBootReasons() {} + ~SubscribeAttributeUserLabelLabelList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLabelListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBootReasonsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.BootReasons response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.LabelList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveHardwareFaults + * Attribute GeneratedCommandList */ -class ReadGeneralDiagnosticsActiveHardwareFaults : public ReadAttribute { +class ReadUserLabelGeneratedCommandList : public ReadAttribute { public: - ReadGeneralDiagnosticsActiveHardwareFaults() - : ReadAttribute("active-hardware-faults") - { - } - - ~ReadGeneralDiagnosticsActiveHardwareFaults() {} + ReadUserLabelGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadUserLabelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUserLabelGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUserLabelGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeUserLabelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000005) on endpoint %u", endpointId); +/* + * Attribute AcceptedCommandList + */ +class ReadUserLabelAcceptedCommandList : public ReadAttribute { +public: + ReadUserLabelAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadUserLabelAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUserLabelAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUserLabelAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeUserLabelAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveHardwareFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics ActiveHardwareFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadUserLabelAttributeList : public ReadAttribute { +public: + ReadUserLabelAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadUserLabelAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults : public SubscribeAttribute { +class SubscribeAttributeUserLabelAttributeList : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() - : SubscribeAttribute("active-hardware-faults") - { - } + SubscribeAttributeUserLabelAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() {} + ~SubscribeAttributeUserLabelAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveHardwareFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveRadioFaults + * Attribute FeatureMap */ -class ReadGeneralDiagnosticsActiveRadioFaults : public ReadAttribute { +class ReadUserLabelFeatureMap : public ReadAttribute { public: - ReadGeneralDiagnosticsActiveRadioFaults() - : ReadAttribute("active-radio-faults") - { - } - - ~ReadGeneralDiagnosticsActiveRadioFaults() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveRadioFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics ActiveRadioFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUserLabelFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadUserLabelFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UserLabel.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsActiveRadioFaults : public SubscribeAttribute { +class SubscribeAttributeUserLabelFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() - : SubscribeAttribute("active-radio-faults") - { - } + SubscribeAttributeUserLabelFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() {} + ~SubscribeAttributeUserLabelFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveRadioFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveNetworkFaults + * Attribute ClusterRevision */ -class ReadGeneralDiagnosticsActiveNetworkFaults : public ReadAttribute { +class ReadUserLabelClusterRevision : public ReadAttribute { public: - ReadGeneralDiagnosticsActiveNetworkFaults() - : ReadAttribute("active-network-faults") - { - } + ReadUserLabelClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadUserLabelClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("UserLabel ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadGeneralDiagnosticsActiveNetworkFaults() {} +class SubscribeAttributeUserLabelClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeUserLabelClusterRevision() + : SubscribeAttribute("cluster-revision") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000007) on endpoint %u", endpointId); + ~SubscribeAttributeUserLabelClusterRevision() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveNetworkFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics ActiveNetworkFaults read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000041) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUserLabel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults : public SubscribeAttribute { -public: - SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() - : SubscribeAttribute("active-network-faults") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UserLabel.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - ~SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() {} + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveNetworkFaultsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster BooleanState | 0x0045 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * StateValue | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * StateChange | 0x0000 | +\*----------------------------------------------------------------------------*/ /* - * Attribute TestEventTriggersEnabled + * Attribute StateValue */ -class ReadGeneralDiagnosticsTestEventTriggersEnabled : public ReadAttribute { +class ReadBooleanStateStateValue : public ReadAttribute { public: - ReadGeneralDiagnosticsTestEventTriggersEnabled() - : ReadAttribute("test-event-triggers-enabled") - { - } - - ~ReadGeneralDiagnosticsTestEventTriggersEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTestEventTriggersEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics TestEventTriggersEnabled read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBooleanStateStateValue() : ReadAttribute("state-value") {} + + ~ReadBooleanStateStateValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStateValueWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BooleanState.StateValue response %@", [value description]); + if (error != nil) { + LogNSError("BooleanState StateValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled : public SubscribeAttribute { +class SubscribeAttributeBooleanStateStateValue : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() - : SubscribeAttribute("test-event-triggers-enabled") - { - } + SubscribeAttributeBooleanStateStateValue() + : SubscribeAttribute("state-value") {} - ~SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() {} + ~SubscribeAttributeBooleanStateStateValue() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStateValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTestEventTriggersEnabledWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.StateValue response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute GeneratedCommandList */ -class ReadGeneralDiagnosticsGeneratedCommandList : public ReadAttribute { -public: - ReadGeneralDiagnosticsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadGeneralDiagnosticsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeGeneralDiagnosticsGeneratedCommandList : public SubscribeAttribute { +class ReadBooleanStateGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBooleanStateGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBooleanStateGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BooleanState GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBooleanStateGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBooleanStateGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBooleanStateGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AcceptedCommandList */ -class ReadGeneralDiagnosticsAcceptedCommandList : public ReadAttribute { -public: - ReadGeneralDiagnosticsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadGeneralDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeGeneralDiagnosticsAcceptedCommandList : public SubscribeAttribute { +class ReadBooleanStateAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBooleanStateAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBooleanStateAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BooleanState AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBooleanStateAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBooleanStateAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBooleanStateAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadGeneralDiagnosticsAttributeList : public ReadAttribute { +class ReadBooleanStateAttributeList : public ReadAttribute { public: - ReadGeneralDiagnosticsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadGeneralDiagnosticsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBooleanStateAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBooleanStateAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("BooleanState AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsAttributeList : public SubscribeAttribute { +class SubscribeAttributeBooleanStateAttributeList : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeBooleanStateAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeGeneralDiagnosticsAttributeList() {} + ~SubscribeAttributeBooleanStateAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadGeneralDiagnosticsFeatureMap : public ReadAttribute { +class ReadBooleanStateFeatureMap : public ReadAttribute { public: - ReadGeneralDiagnosticsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadGeneralDiagnosticsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBooleanStateFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBooleanStateFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BooleanState.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("BooleanState FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGeneralDiagnosticsFeatureMap : public SubscribeAttribute { +class SubscribeAttributeBooleanStateFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeGeneralDiagnosticsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeBooleanStateFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeGeneralDiagnosticsFeatureMap() {} + ~SubscribeAttributeBooleanStateFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadGeneralDiagnosticsClusterRevision : public ReadAttribute { -public: - ReadGeneralDiagnosticsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadGeneralDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("GeneralDiagnostics ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeGeneralDiagnosticsClusterRevision : public SubscribeAttribute { +class ReadBooleanStateClusterRevision : public ReadAttribute { public: - SubscribeAttributeGeneralDiagnosticsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeGeneralDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000033) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GeneralDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBooleanStateClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBooleanStateClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("BooleanState ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBooleanStateClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBooleanStateClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBooleanStateClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000045) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBooleanState alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BooleanState.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster SoftwareDiagnostics | 0x0034 | +| Cluster ModeSelect | 0x0050 | |------------------------------------------------------------------------------| | Commands: | | -| * ResetWatermarks | 0x00 | +| * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * ThreadMetrics | 0x0000 | -| * CurrentHeapFree | 0x0001 | -| * CurrentHeapUsed | 0x0002 | -| * CurrentHeapHighWatermark | 0x0003 | +| * Description | 0x0000 | +| * StandardNamespace | 0x0001 | +| * SupportedModes | 0x0002 | +| * CurrentMode | 0x0003 | +| * StartUpMode | 0x0004 | +| * OnMode | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -22586,5590 +43162,10863 @@ class SubscribeAttributeGeneralDiagnosticsClusterRevision : public SubscribeAttr | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * SoftwareFault | 0x0000 | \*----------------------------------------------------------------------------*/ /* - * Command ResetWatermarks + * Command ChangeToMode */ -class SoftwareDiagnosticsResetWatermarks : public ClusterCommand { +class ModeSelectChangeToMode : public ClusterCommand { public: - SoftwareDiagnosticsResetWatermarks() - : ClusterCommand("reset-watermarks") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSoftwareDiagnosticsClusterResetWatermarksParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster resetWatermarksWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ModeSelectChangeToMode() : ClusterCommand("change-to-mode") { + AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000050) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRModeSelectClusterChangeToModeParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster changeToModeWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type mRequest; }; /* - * Attribute ThreadMetrics + * Attribute Description */ -class ReadSoftwareDiagnosticsThreadMetrics : public ReadAttribute { +class ReadModeSelectDescription : public ReadAttribute { public: - ReadSoftwareDiagnosticsThreadMetrics() - : ReadAttribute("thread-metrics") - { - } - - ~ReadSoftwareDiagnosticsThreadMetrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeThreadMetricsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics ThreadMetrics read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadModeSelectDescription() : ReadAttribute("description") {} + + ~ReadModeSelectDescription() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDescriptionWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.Description response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect Description read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsThreadMetrics : public SubscribeAttribute { +class SubscribeAttributeModeSelectDescription : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsThreadMetrics() - : SubscribeAttribute("thread-metrics") - { - } + SubscribeAttributeModeSelectDescription() + : SubscribeAttribute("description") {} - ~SubscribeAttributeSoftwareDiagnosticsThreadMetrics() {} + ~SubscribeAttributeModeSelectDescription() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDescriptionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeThreadMetricsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.Description response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentHeapFree + * Attribute StandardNamespace */ -class ReadSoftwareDiagnosticsCurrentHeapFree : public ReadAttribute { +class ReadModeSelectStandardNamespace : public ReadAttribute { public: - ReadSoftwareDiagnosticsCurrentHeapFree() - : ReadAttribute("current-heap-free") - { - } - - ~ReadSoftwareDiagnosticsCurrentHeapFree() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x00000001) on endpoint %u", endpointId); + ReadModeSelectStandardNamespace() : ReadAttribute("standard-namespace") {} + + ~ReadModeSelectStandardNamespace() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStandardNamespaceWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect StandardNamespace read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeModeSelectStandardNamespace + : public SubscribeAttribute { +public: + SubscribeAttributeModeSelectStandardNamespace() + : SubscribeAttribute("standard-namespace") {} + + ~SubscribeAttributeModeSelectStandardNamespace() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStandardNamespaceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.StandardNamespace response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentHeapFreeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics CurrentHeapFree read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute SupportedModes + */ +class ReadModeSelectSupportedModes : public ReadAttribute { +public: + ReadModeSelectSupportedModes() : ReadAttribute("supported-modes") {} + + ~ReadModeSelectSupportedModes() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedModesWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.SupportedModes response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect SupportedModes read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree : public SubscribeAttribute { +class SubscribeAttributeModeSelectSupportedModes : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() - : SubscribeAttribute("current-heap-free") - { - } + SubscribeAttributeModeSelectSupportedModes() + : SubscribeAttribute("supported-modes") {} - ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() {} + ~SubscribeAttributeModeSelectSupportedModes() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedModesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentHeapFreeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.SupportedModes response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentHeapUsed + * Attribute CurrentMode */ -class ReadSoftwareDiagnosticsCurrentHeapUsed : public ReadAttribute { +class ReadModeSelectCurrentMode : public ReadAttribute { public: - ReadSoftwareDiagnosticsCurrentHeapUsed() - : ReadAttribute("current-heap-used") - { - } + ReadModeSelectCurrentMode() : ReadAttribute("current-mode") {} + + ~ReadModeSelectCurrentMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect CurrentMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadSoftwareDiagnosticsCurrentHeapUsed() {} +class SubscribeAttributeModeSelectCurrentMode : public SubscribeAttribute { +public: + SubscribeAttributeModeSelectCurrentMode() + : SubscribeAttribute("current-mode") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x00000002) on endpoint %u", endpointId); + ~SubscribeAttributeModeSelectCurrentMode() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentHeapUsedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics CurrentHeapUsed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed : public SubscribeAttribute { -public: - SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() - : SubscribeAttribute("current-heap-used") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeCurrentModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentHeapUsedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; + return CHIP_NO_ERROR; + } +}; /* - * Attribute CurrentHeapHighWatermark + * Attribute StartUpMode */ -class ReadSoftwareDiagnosticsCurrentHeapHighWatermark : public ReadAttribute { +class ReadModeSelectStartUpMode : public ReadAttribute { public: - ReadSoftwareDiagnosticsCurrentHeapHighWatermark() - : ReadAttribute("current-heap-high-watermark") - { - } - - ~ReadSoftwareDiagnosticsCurrentHeapHighWatermark() {} + ReadModeSelectStartUpMode() : ReadAttribute("start-up-mode") {} + + ~ReadModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartUpModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.StartUpMode response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect StartUpMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x00000003) on endpoint %u", endpointId); +class WriteModeSelectStartUpMode : public WriteAttribute { +public: + WriteModeSelectStartUpMode() : WriteAttribute("start-up-mode") { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeStartUpModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ModeSelect StartUpMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentHeapHighWatermarkWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics CurrentHeapHighWatermark read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark : public SubscribeAttribute { +class SubscribeAttributeModeSelectStartUpMode : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() - : SubscribeAttribute("current-heap-high-watermark") - { - } + SubscribeAttributeModeSelectStartUpMode() + : SubscribeAttribute("start-up-mode") {} - ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() {} + ~SubscribeAttributeModeSelectStartUpMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartUpModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentHeapHighWatermarkWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.StartUpMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute OnMode */ -class ReadSoftwareDiagnosticsGeneratedCommandList : public ReadAttribute { +class ReadModeSelectOnMode : public ReadAttribute { public: - ReadSoftwareDiagnosticsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadSoftwareDiagnosticsGeneratedCommandList() {} + ReadModeSelectOnMode() : ReadAttribute("on-mode") {} + + ~ReadModeSelectOnMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOnModeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ModeSelect.OnMode response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect OnMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteModeSelectOnMode : public WriteAttribute { +public: + WriteModeSelectOnMode() : WriteAttribute("on-mode") { + AddArgument("attr-name", "on-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteModeSelectOnMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeOnModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ModeSelect OnMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeModeSelectOnMode : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeModeSelectOnMode() : SubscribeAttribute("on-mode") {} - ~SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() {} + ~SubscribeAttributeModeSelectOnMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOnModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.OnMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute GeneratedCommandList */ -class ReadSoftwareDiagnosticsAcceptedCommandList : public ReadAttribute { +class ReadModeSelectGeneratedCommandList : public ReadAttribute { public: - ReadSoftwareDiagnosticsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadSoftwareDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadModeSelectGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadModeSelectGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ModeSelect GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeModeSelectGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeModeSelectGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeModeSelectGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadModeSelectAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadModeSelectAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadModeSelectAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeModeSelectAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeModeSelectAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeModeSelectAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadSoftwareDiagnosticsAttributeList : public ReadAttribute { +class ReadModeSelectAttributeList : public ReadAttribute { public: - ReadSoftwareDiagnosticsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadSoftwareDiagnosticsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadModeSelectAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadModeSelectAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsAttributeList : public SubscribeAttribute { +class SubscribeAttributeModeSelectAttributeList : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeModeSelectAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeSoftwareDiagnosticsAttributeList() {} + ~SubscribeAttributeModeSelectAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadSoftwareDiagnosticsFeatureMap : public ReadAttribute { +class ReadModeSelectFeatureMap : public ReadAttribute { public: - ReadSoftwareDiagnosticsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadSoftwareDiagnosticsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadModeSelectFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadModeSelectFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ModeSelect.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsFeatureMap : public SubscribeAttribute { +class SubscribeAttributeModeSelectFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeModeSelectFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeSoftwareDiagnosticsFeatureMap() {} + ~SubscribeAttributeModeSelectFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadSoftwareDiagnosticsClusterRevision : public ReadAttribute { +class ReadModeSelectClusterRevision : public ReadAttribute { public: - ReadSoftwareDiagnosticsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadSoftwareDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("SoftwareDiagnostics ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadModeSelectClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadModeSelectClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("ModeSelect ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSoftwareDiagnosticsClusterRevision : public SubscribeAttribute { +class SubscribeAttributeModeSelectClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeSoftwareDiagnosticsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeModeSelectClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeSoftwareDiagnosticsClusterRevision() {} + ~SubscribeAttributeModeSelectClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000034) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000050) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterModeSelect alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster ThreadNetworkDiagnostics | 0x0035 | +| Cluster DoorLock | 0x0101 | |------------------------------------------------------------------------------| | Commands: | | -| * ResetCounts | 0x00 | +| * LockDoor | 0x00 | +| * UnlockDoor | 0x01 | +| * UnlockWithTimeout | 0x03 | +| * SetWeekDaySchedule | 0x0B | +| * GetWeekDaySchedule | 0x0C | +| * ClearWeekDaySchedule | 0x0D | +| * SetYearDaySchedule | 0x0E | +| * GetYearDaySchedule | 0x0F | +| * ClearYearDaySchedule | 0x10 | +| * SetHolidaySchedule | 0x11 | +| * GetHolidaySchedule | 0x12 | +| * ClearHolidaySchedule | 0x13 | +| * SetUser | 0x1A | +| * GetUser | 0x1B | +| * ClearUser | 0x1D | +| * SetCredential | 0x22 | +| * GetCredentialStatus | 0x24 | +| * ClearCredential | 0x26 | |------------------------------------------------------------------------------| | Attributes: | | -| * Channel | 0x0000 | -| * RoutingRole | 0x0001 | -| * NetworkName | 0x0002 | -| * PanId | 0x0003 | -| * ExtendedPanId | 0x0004 | -| * MeshLocalPrefix | 0x0005 | -| * OverrunCount | 0x0006 | -| * NeighborTableList | 0x0007 | -| * RouteTableList | 0x0008 | -| * PartitionId | 0x0009 | -| * Weighting | 0x000A | -| * DataVersion | 0x000B | -| * StableDataVersion | 0x000C | -| * LeaderRouterId | 0x000D | -| * DetachedRoleCount | 0x000E | -| * ChildRoleCount | 0x000F | -| * RouterRoleCount | 0x0010 | -| * LeaderRoleCount | 0x0011 | -| * AttachAttemptCount | 0x0012 | -| * PartitionIdChangeCount | 0x0013 | -| * BetterPartitionAttachAttemptCount | 0x0014 | -| * ParentChangeCount | 0x0015 | -| * TxTotalCount | 0x0016 | -| * TxUnicastCount | 0x0017 | -| * TxBroadcastCount | 0x0018 | -| * TxAckRequestedCount | 0x0019 | -| * TxAckedCount | 0x001A | -| * TxNoAckRequestedCount | 0x001B | -| * TxDataCount | 0x001C | -| * TxDataPollCount | 0x001D | -| * TxBeaconCount | 0x001E | -| * TxBeaconRequestCount | 0x001F | -| * TxOtherCount | 0x0020 | -| * TxRetryCount | 0x0021 | -| * TxDirectMaxRetryExpiryCount | 0x0022 | -| * TxIndirectMaxRetryExpiryCount | 0x0023 | -| * TxErrCcaCount | 0x0024 | -| * TxErrAbortCount | 0x0025 | -| * TxErrBusyChannelCount | 0x0026 | -| * RxTotalCount | 0x0027 | -| * RxUnicastCount | 0x0028 | -| * RxBroadcastCount | 0x0029 | -| * RxDataCount | 0x002A | -| * RxDataPollCount | 0x002B | -| * RxBeaconCount | 0x002C | -| * RxBeaconRequestCount | 0x002D | -| * RxOtherCount | 0x002E | -| * RxAddressFilteredCount | 0x002F | -| * RxDestAddrFilteredCount | 0x0030 | -| * RxDuplicatedCount | 0x0031 | -| * RxErrNoFrameCount | 0x0032 | -| * RxErrUnknownNeighborCount | 0x0033 | -| * RxErrInvalidSrcAddrCount | 0x0034 | -| * RxErrSecCount | 0x0035 | -| * RxErrFcsCount | 0x0036 | -| * RxErrOtherCount | 0x0037 | -| * ActiveTimestamp | 0x0038 | -| * PendingTimestamp | 0x0039 | -| * Delay | 0x003A | -| * SecurityPolicy | 0x003B | -| * ChannelPage0Mask | 0x003C | -| * OperationalDatasetComponents | 0x003D | -| * ActiveNetworkFaultsList | 0x003E | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * ConnectionStatus | 0x0000 | -| * NetworkFaultChange | 0x0001 | -\*----------------------------------------------------------------------------*/ - -/* - * Command ResetCounts - */ -class ThreadNetworkDiagnosticsResetCounts : public ClusterCommand { -public: - ThreadNetworkDiagnosticsResetCounts() - : ClusterCommand("reset-counts") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRThreadNetworkDiagnosticsClusterResetCountsParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster resetCountsWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; +| * LockState | 0x0000 | +| * LockType | 0x0001 | +| * ActuatorEnabled | 0x0002 | +| * DoorState | 0x0003 | +| * DoorOpenEvents | 0x0004 | +| * DoorClosedEvents | 0x0005 | +| * OpenPeriod | 0x0006 | +| * NumberOfTotalUsersSupported | 0x0011 | +| * NumberOfPINUsersSupported | 0x0012 | +| * NumberOfRFIDUsersSupported | 0x0013 | +| * NumberOfWeekDaySchedulesSupportedPerUser | 0x0014 | +| * NumberOfYearDaySchedulesSupportedPerUser | 0x0015 | +| * NumberOfHolidaySchedulesSupported | 0x0016 | +| * MaxPINCodeLength | 0x0017 | +| * MinPINCodeLength | 0x0018 | +| * MaxRFIDCodeLength | 0x0019 | +| * MinRFIDCodeLength | 0x001A | +| * CredentialRulesSupport | 0x001B | +| * NumberOfCredentialsSupportedPerUser | 0x001C | +| * Language | 0x0021 | +| * LEDSettings | 0x0022 | +| * AutoRelockTime | 0x0023 | +| * SoundVolume | 0x0024 | +| * OperatingMode | 0x0025 | +| * SupportedOperatingModes | 0x0026 | +| * DefaultConfigurationRegister | 0x0027 | +| * EnableLocalProgramming | 0x0028 | +| * EnableOneTouchLocking | 0x0029 | +| * EnableInsideStatusLED | 0x002A | +| * EnablePrivacyModeButton | 0x002B | +| * LocalProgrammingFeatures | 0x002C | +| * WrongCodeEntryLimit | 0x0030 | +| * UserCodeTemporaryDisableTime | 0x0031 | +| * SendPINOverTheAir | 0x0032 | +| * RequirePINforRemoteOperation | 0x0033 | +| * ExpiringUserTimeout | 0x0035 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * DoorLockAlarm | 0x0000 | +| * DoorStateChange | 0x0001 | +| * LockOperation | 0x0002 | +| * LockOperationError | 0x0003 | +| * LockUserChange | 0x0004 | +\*----------------------------------------------------------------------------*/ + +/* + * Command LockDoor + */ +class DoorLockLockDoor : public ClusterCommand { +public: + DoorLockLockDoor() : ClusterCommand("lock-door") { + AddArgument("PinCode", &mRequest.pinCode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterLockDoorParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.pinCode.HasValue()) { + params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() + length:mRequest.pinCode.Value().size()]; + } else { + params.pinCode = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster lockDoorWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: + chip::app::Clusters::DoorLock::Commands::LockDoor::Type mRequest; }; /* - * Attribute Channel + * Command UnlockDoor */ -class ReadThreadNetworkDiagnosticsChannel : public ReadAttribute { +class DoorLockUnlockDoor : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsChannel() - : ReadAttribute("channel") - { + DoorLockUnlockDoor() : ClusterCommand("unlock-door") { + AddArgument("PinCode", &mRequest.pinCode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.pinCode.HasValue()) { + params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() + length:mRequest.pinCode.Value().size()]; + } else { + params.pinCode = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster unlockDoorWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsChannel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeChannelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Channel response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics Channel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsChannel : public SubscribeAttribute { +/* + * Command UnlockWithTimeout + */ +class DoorLockUnlockWithTimeout : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsChannel() - : SubscribeAttribute("channel") - { + DoorLockUnlockWithTimeout() : ClusterCommand("unlock-with-timeout") { + AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); + AddArgument("PinCode", &mRequest.pinCode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.timeout = [NSNumber numberWithUnsignedShort:mRequest.timeout]; + if (mRequest.pinCode.HasValue()) { + params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() + length:mRequest.pinCode.Value().size()]; + } else { + params.pinCode = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster unlockWithTimeoutWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsChannel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeChannelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Channel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type mRequest; }; /* - * Attribute RoutingRole + * Command SetWeekDaySchedule */ -class ReadThreadNetworkDiagnosticsRoutingRole : public ReadAttribute { +class DoorLockSetWeekDaySchedule : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsRoutingRole() - : ReadAttribute("routing-role") - { + DoorLockSetWeekDaySchedule() : ClusterCommand("set-week-day-schedule") { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("DaysMask", 0, UINT8_MAX, &mRequest.daysMask); + AddArgument("StartHour", 0, UINT8_MAX, &mRequest.startHour); + AddArgument("StartMinute", 0, UINT8_MAX, &mRequest.startMinute); + AddArgument("EndHour", 0, UINT8_MAX, &mRequest.endHour); + AddArgument("EndMinute", 0, UINT8_MAX, &mRequest.endMinute); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000000B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.weekDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + params.daysMask = [NSNumber numberWithUnsignedChar:mRequest.daysMask.Raw()]; + params.startHour = [NSNumber numberWithUnsignedChar:mRequest.startHour]; + params.startMinute = [NSNumber numberWithUnsignedChar:mRequest.startMinute]; + params.endHour = [NSNumber numberWithUnsignedChar:mRequest.endHour]; + params.endMinute = [NSNumber numberWithUnsignedChar:mRequest.endMinute]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setWeekDayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsRoutingRole() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRoutingRoleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RoutingRole read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsRoutingRole : public SubscribeAttribute { +/* + * Command GetWeekDaySchedule + */ +class DoorLockGetWeekDaySchedule : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() - : SubscribeAttribute("routing-role") - { + DoorLockGetWeekDaySchedule() : ClusterCommand("get-week-day-schedule") { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000000C) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.weekDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getWeekDayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetWeekDayScheduleResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRoutingRoleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type mRequest; }; /* - * Attribute NetworkName + * Command ClearWeekDaySchedule */ -class ReadThreadNetworkDiagnosticsNetworkName : public ReadAttribute { +class DoorLockClearWeekDaySchedule : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsNetworkName() - : ReadAttribute("network-name") - { + DoorLockClearWeekDaySchedule() : ClusterCommand("clear-week-day-schedule") { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000000D) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterClearWeekDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.weekDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearWeekDayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsNetworkName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNetworkNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics NetworkName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsNetworkName : public SubscribeAttribute { +/* + * Command SetYearDaySchedule + */ +class DoorLockSetYearDaySchedule : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsNetworkName() - : SubscribeAttribute("network-name") - { + DoorLockSetYearDaySchedule() : ClusterCommand("set-year-day-schedule") { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); + AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000000E) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.yearDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + params.localStartTime = + [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; + params.localEndTime = + [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setYearDayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsNetworkName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNetworkNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type mRequest; }; /* - * Attribute PanId + * Command GetYearDaySchedule */ -class ReadThreadNetworkDiagnosticsPanId : public ReadAttribute { +class DoorLockGetYearDaySchedule : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsPanId() - : ReadAttribute("pan-id") - { + DoorLockGetYearDaySchedule() : ClusterCommand("get-year-day-schedule") { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000000F) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.yearDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getYearDayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetYearDayScheduleResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsPanId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePanIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics PanId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsPanId : public SubscribeAttribute { +/* + * Command ClearYearDaySchedule + */ +class DoorLockClearYearDaySchedule : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsPanId() - : SubscribeAttribute("pan-id") - { + DoorLockClearYearDaySchedule() : ClusterCommand("clear-year-day-schedule") { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000010) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.yearDayIndex = + [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearYearDayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsPanId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePanIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type mRequest; }; /* - * Attribute ExtendedPanId + * Command SetHolidaySchedule */ -class ReadThreadNetworkDiagnosticsExtendedPanId : public ReadAttribute { +class DoorLockSetHolidaySchedule : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsExtendedPanId() - : ReadAttribute("extended-pan-id") - { + DoorLockSetHolidaySchedule() : ClusterCommand("set-holiday-schedule") { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); + AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); + AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); + AddArgument("OperatingMode", 0, UINT8_MAX, &mRequest.operatingMode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000011) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.holidayIndex = + [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; + params.localStartTime = + [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; + params.localEndTime = + [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; + params.operatingMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.operatingMode)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setHolidayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsExtendedPanId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeExtendedPanIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ExtendedPanId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId : public SubscribeAttribute { +/* + * Command GetHolidaySchedule + */ +class DoorLockGetHolidaySchedule : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() - : SubscribeAttribute("extended-pan-id") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeExtendedPanIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; + DoorLockGetHolidaySchedule() : ClusterCommand("get-holiday-schedule") { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000012) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.holidayIndex = + [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getHolidayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetHolidayScheduleResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type mRequest; }; /* - * Attribute MeshLocalPrefix + * Command ClearHolidaySchedule */ -class ReadThreadNetworkDiagnosticsMeshLocalPrefix : public ReadAttribute { +class DoorLockClearHolidaySchedule : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsMeshLocalPrefix() - : ReadAttribute("mesh-local-prefix") - { + DoorLockClearHolidaySchedule() : ClusterCommand("clear-holiday-schedule") { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000013) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterClearHolidayScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.holidayIndex = + [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearHolidayScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsMeshLocalPrefix() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeshLocalPrefixWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics MeshLocalPrefix read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix : public SubscribeAttribute { +/* + * Command SetUser + */ +class DoorLockSetUser : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() - : SubscribeAttribute("mesh-local-prefix") - { + DoorLockSetUser() : ClusterCommand("set-user") { + AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("UserName", &mRequest.userName); + AddArgument("UserUniqueId", 0, UINT32_MAX, &mRequest.userUniqueId); + AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); + AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); + AddArgument("CredentialRule", 0, UINT8_MAX, &mRequest.credentialRule); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000001A) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.operationType = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + if (mRequest.userName.IsNull()) { + params.userName = nil; + } else { + params.userName = + [[NSString alloc] initWithBytes:mRequest.userName.Value().data() + length:mRequest.userName.Value().size() + encoding:NSUTF8StringEncoding]; + } + if (mRequest.userUniqueId.IsNull()) { + params.userUniqueId = nil; + } else { + params.userUniqueId = + [NSNumber numberWithUnsignedInt:mRequest.userUniqueId.Value()]; + } + if (mRequest.userStatus.IsNull()) { + params.userStatus = nil; + } else { + params.userStatus = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.userStatus.Value())]; + } + if (mRequest.userType.IsNull()) { + params.userType = nil; + } else { + params.userType = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.userType.Value())]; + } + if (mRequest.credentialRule.IsNull()) { + params.credentialRule = nil; + } else { + params.credentialRule = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.credentialRule.Value())]; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setUserWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() {} +private: + chip::app::Clusters::DoorLock::Commands::SetUser::Type mRequest; +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeshLocalPrefixWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Command GetUser + */ +class DoorLockGetUser : public ClusterCommand { +public: + DoorLockGetUser() : ClusterCommand("get-user") { + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000001B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterGetUserParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getUserWithParams:params + completion:^( + MTRDoorLockClusterGetUserResponseParams *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::GetUser::Type mRequest; }; /* - * Attribute OverrunCount + * Command ClearUser */ -class ReadThreadNetworkDiagnosticsOverrunCount : public ReadAttribute { +class DoorLockClearUser : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsOverrunCount() - : ReadAttribute("overrun-count") - { + DoorLockClearUser() : ClusterCommand("clear-user") { + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x0000001D) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearUserWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsOverrunCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics OverrunCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::DoorLock::Commands::ClearUser::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsOverrunCount : public SubscribeAttribute { +/* + * Command SetCredential + */ +class DoorLockSetCredential : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() - : SubscribeAttribute("overrun-count") - { + DoorLockSetCredential() + : ClusterCommand("set-credential"), + mComplex_Credential(&mRequest.credential) { + AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); + AddArgument("Credential", &mComplex_Credential); + AddArgument("CredentialData", &mRequest.credentialData); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); + AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000022) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.operationType = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; + params.credential = [MTRDoorLockClusterDlCredential new]; + params.credential.credentialType = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.credential.credentialType)]; + params.credential.credentialIndex = + [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; + params.credentialData = + [NSData dataWithBytes:mRequest.credentialData.data() + length:mRequest.credentialData.size()]; + if (mRequest.userIndex.IsNull()) { + params.userIndex = nil; + } else { + params.userIndex = + [NSNumber numberWithUnsignedShort:mRequest.userIndex.Value()]; + } + if (mRequest.userStatus.IsNull()) { + params.userStatus = nil; + } else { + params.userStatus = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.userStatus.Value())]; + } + if (mRequest.userType.IsNull()) { + params.userType = nil; + } else { + params.userType = + [NSNumber numberWithUnsignedChar:chip::to_underlying( + mRequest.userType.Value())]; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setCredentialWithParams:params + completion:^( + MTRDoorLockClusterSetCredentialResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOverrunCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus(error); - }]; +private: + chip::app::Clusters::DoorLock::Commands::SetCredential::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::DoorLock::Structs::DlCredential::Type> + mComplex_Credential; +}; - return CHIP_NO_ERROR; +/* + * Command GetCredentialStatus + */ +class DoorLockGetCredentialStatus : public ClusterCommand { +public: + DoorLockGetCredentialStatus() + : ClusterCommand("get-credential-status"), + mComplex_Credential(&mRequest.credential) { + AddArgument("Credential", &mComplex_Credential); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000024) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.credential = [MTRDoorLockClusterDlCredential new]; + params.credential.credentialType = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.credential.credentialType)]; + params.credential.credentialIndex = + [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getCredentialStatusWithParams:params + completion:^( + MTRDoorLockClusterGetCredentialStatusResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::DoorLock::Structs::DlCredential::Type> + mComplex_Credential; }; /* - * Attribute NeighborTableList + * Command ClearCredential */ -class ReadThreadNetworkDiagnosticsNeighborTableList : public ReadAttribute { +class DoorLockClearCredential : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsNeighborTableList() - : ReadAttribute("neighbor-table-list") - { + DoorLockClearCredential() + : ClusterCommand("clear-credential"), + mComplex_Credential(&mRequest.credential) { + AddArgument("Credential", &mComplex_Credential); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000101) command (0x00000026) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.credential.IsNull()) { + params.credential = nil; + } else { + params.credential = [MTRDoorLockClusterDlCredential new]; + params.credential.credentialType = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.credential.Value() + .credentialType)]; + params.credential.credentialIndex = [NSNumber + numberWithUnsignedShort:mRequest.credential.Value().credentialIndex]; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearCredentialWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsNeighborTableList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000007) on endpoint %u", endpointId); +private: + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type mRequest; + TypedComplexArgument> + mComplex_Credential; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNeighborTableListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.NeighborTableList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics NeighborTableList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute LockState + */ +class ReadDoorLockLockState : public ReadAttribute { +public: + ReadDoorLockLockState() : ReadAttribute("lock-state") {} + + ~ReadDoorLockLockState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLockStateWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.LockState response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock LockState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList : public SubscribeAttribute { +class SubscribeAttributeDoorLockLockState : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList() - : SubscribeAttribute("neighbor-table-list") - { - } + SubscribeAttributeDoorLockLockState() : SubscribeAttribute("lock-state") {} - ~SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList() {} + ~SubscribeAttributeDoorLockLockState() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLockStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNeighborTableListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.NeighborTableList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LockState response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RouteTableList + * Attribute LockType */ -class ReadThreadNetworkDiagnosticsRouteTableList : public ReadAttribute { +class ReadDoorLockLockType : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRouteTableList() - : ReadAttribute("route-table-list") - { - } - - ~ReadThreadNetworkDiagnosticsRouteTableList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRouteTableListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RouteTableList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RouteTableList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockLockType() : ReadAttribute("lock-type") {} + + ~ReadDoorLockLockType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLockTypeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.LockType response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock LockType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRouteTableList : public SubscribeAttribute { +class SubscribeAttributeDoorLockLockType : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRouteTableList() - : SubscribeAttribute("route-table-list") - { - } + SubscribeAttributeDoorLockLockType() : SubscribeAttribute("lock-type") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRouteTableList() {} + ~SubscribeAttributeDoorLockLockType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLockTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRouteTableListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RouteTableList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LockType response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PartitionId + * Attribute ActuatorEnabled */ -class ReadThreadNetworkDiagnosticsPartitionId : public ReadAttribute { +class ReadDoorLockActuatorEnabled : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsPartitionId() - : ReadAttribute("partition-id") - { - } - - ~ReadThreadNetworkDiagnosticsPartitionId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePartitionIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics PartitionId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockActuatorEnabled() : ReadAttribute("actuator-enabled") {} + + ~ReadDoorLockActuatorEnabled() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActuatorEnabledWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock ActuatorEnabled read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsPartitionId : public SubscribeAttribute { +class SubscribeAttributeDoorLockActuatorEnabled : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsPartitionId() - : SubscribeAttribute("partition-id") - { - } + SubscribeAttributeDoorLockActuatorEnabled() + : SubscribeAttribute("actuator-enabled") {} - ~SubscribeAttributeThreadNetworkDiagnosticsPartitionId() {} + ~SubscribeAttributeDoorLockActuatorEnabled() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActuatorEnabledWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePartitionIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Weighting + * Attribute DoorState */ -class ReadThreadNetworkDiagnosticsWeighting : public ReadAttribute { +class ReadDoorLockDoorState : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsWeighting() - : ReadAttribute("weighting") - { - } - - ~ReadThreadNetworkDiagnosticsWeighting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWeightingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics Weighting read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockDoorState() : ReadAttribute("door-state") {} + + ~ReadDoorLockDoorState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDoorStateWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.DoorState response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock DoorState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsWeighting : public SubscribeAttribute { +class SubscribeAttributeDoorLockDoorState : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsWeighting() - : SubscribeAttribute("weighting") - { - } + SubscribeAttributeDoorLockDoorState() : SubscribeAttribute("door-state") {} - ~SubscribeAttributeThreadNetworkDiagnosticsWeighting() {} + ~SubscribeAttributeDoorLockDoorState() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDoorStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeWeightingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DoorState response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DataVersion + * Attribute DoorOpenEvents */ -class ReadThreadNetworkDiagnosticsDataVersion : public ReadAttribute { +class ReadDoorLockDoorOpenEvents : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsDataVersion() - : ReadAttribute("data-version") - { - } - - ~ReadThreadNetworkDiagnosticsDataVersion() {} + ReadDoorLockDoorOpenEvents() : ReadAttribute("door-open-events") {} + + ~ReadDoorLockDoorOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDoorOpenEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock DoorOpenEvents read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000B) on endpoint %u", endpointId); +class WriteDoorLockDoorOpenEvents : public WriteAttribute { +public: + WriteDoorLockDoorOpenEvents() : WriteAttribute("door-open-events") { + AddArgument("attr-name", "door-open-events"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockDoorOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeDoorOpenEventsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock DoorOpenEvents " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDataVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics DataVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsDataVersion : public SubscribeAttribute { +class SubscribeAttributeDoorLockDoorOpenEvents : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsDataVersion() - : SubscribeAttribute("data-version") - { - } + SubscribeAttributeDoorLockDoorOpenEvents() + : SubscribeAttribute("door-open-events") {} - ~SubscribeAttributeThreadNetworkDiagnosticsDataVersion() {} + ~SubscribeAttributeDoorLockDoorOpenEvents() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDoorOpenEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDataVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute StableDataVersion + * Attribute DoorClosedEvents */ -class ReadThreadNetworkDiagnosticsStableDataVersion : public ReadAttribute { +class ReadDoorLockDoorClosedEvents : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsStableDataVersion() - : ReadAttribute("stable-data-version") - { - } - - ~ReadThreadNetworkDiagnosticsStableDataVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStableDataVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics StableDataVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockDoorClosedEvents() : ReadAttribute("door-closed-events") {} + + ~ReadDoorLockDoorClosedEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDoorClosedEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock DoorClosedEvents read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion : public SubscribeAttribute { +class WriteDoorLockDoorClosedEvents : public WriteAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() - : SubscribeAttribute("stable-data-version") - { - } + WriteDoorLockDoorClosedEvents() : WriteAttribute("door-closed-events") { + AddArgument("attr-name", "door-closed-events"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockDoorClosedEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeDoorClosedEventsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock DoorClosedEvents " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() {} +private: + uint32_t mValue; +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStableDataVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; +class SubscribeAttributeDoorLockDoorClosedEvents : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockDoorClosedEvents() + : SubscribeAttribute("door-closed-events") {} - return CHIP_NO_ERROR; + ~SubscribeAttributeDoorLockDoorClosedEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDoorClosedEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LeaderRouterId + * Attribute OpenPeriod */ -class ReadThreadNetworkDiagnosticsLeaderRouterId : public ReadAttribute { +class ReadDoorLockOpenPeriod : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsLeaderRouterId() - : ReadAttribute("leader-router-id") - { - } - - ~ReadThreadNetworkDiagnosticsLeaderRouterId() {} + ReadDoorLockOpenPeriod() : ReadAttribute("open-period") {} + + ~ReadDoorLockOpenPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOpenPeriodWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.OpenPeriod response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock OpenPeriod read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000D) on endpoint %u", endpointId); +class WriteDoorLockOpenPeriod : public WriteAttribute { +public: + WriteDoorLockOpenPeriod() : WriteAttribute("open-period") { + AddArgument("attr-name", "open-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockOpenPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeOpenPeriodWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock OpenPeriod write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLeaderRouterIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics LeaderRouterId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId : public SubscribeAttribute { +class SubscribeAttributeDoorLockOpenPeriod : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() - : SubscribeAttribute("leader-router-id") - { - } + SubscribeAttributeDoorLockOpenPeriod() : SubscribeAttribute("open-period") {} - ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() {} + ~SubscribeAttributeDoorLockOpenPeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOpenPeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLeaderRouterIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.OpenPeriod response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DetachedRoleCount + * Attribute NumberOfTotalUsersSupported */ -class ReadThreadNetworkDiagnosticsDetachedRoleCount : public ReadAttribute { +class ReadDoorLockNumberOfTotalUsersSupported : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsDetachedRoleCount() - : ReadAttribute("detached-role-count") - { - } - - ~ReadThreadNetworkDiagnosticsDetachedRoleCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDetachedRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics DetachedRoleCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockNumberOfTotalUsersSupported() + : ReadAttribute("number-of-total-users-supported") {} + + ~ReadDoorLockNumberOfTotalUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock NumberOfTotalUsersSupported read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfTotalUsersSupported + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfTotalUsersSupported() + : SubscribeAttribute("number-of-total-users-supported") {} + + ~SubscribeAttributeDoorLockNumberOfTotalUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfTotalUsersSupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount : public SubscribeAttribute { +/* + * Attribute NumberOfPINUsersSupported + */ +class ReadDoorLockNumberOfPINUsersSupported : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() - : SubscribeAttribute("detached-role-count") - { - } + ReadDoorLockNumberOfPINUsersSupported() + : ReadAttribute("number-of-pinusers-supported") {} + + ~ReadDoorLockNumberOfPINUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfPINUsersSupportedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock NumberOfPINUsersSupported read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfPINUsersSupported + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfPINUsersSupported() + : SubscribeAttribute("number-of-pinusers-supported") {} + + ~SubscribeAttributeDoorLockNumberOfPINUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfPINUsersSupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() {} +/* + * Attribute NumberOfRFIDUsersSupported + */ +class ReadDoorLockNumberOfRFIDUsersSupported : public ReadAttribute { +public: + ReadDoorLockNumberOfRFIDUsersSupported() + : ReadAttribute("number-of-rfidusers-supported") {} + + ~ReadDoorLockNumberOfRFIDUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfRFIDUsersSupportedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock NumberOfRFIDUsersSupported read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfRFIDUsersSupported + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() + : SubscribeAttribute("number-of-rfidusers-supported") {} + + ~SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfRFIDUsersSupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDetachedRoleCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute NumberOfWeekDaySchedulesSupportedPerUser + */ +class ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser + : public ReadAttribute { +public: + ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() + : ReadAttribute("number-of-week-day-schedules-supported-per-user") {} + + ~ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", + [value description]); + if (error != nil) { + LogNSError( + "DoorLock NumberOfWeekDaySchedulesSupportedPerUser read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() + : SubscribeAttribute("number-of-week-day-schedules-supported-per-user") {} + + ~SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute NumberOfYearDaySchedulesSupportedPerUser + */ +class ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser + : public ReadAttribute { +public: + ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() + : ReadAttribute("number-of-year-day-schedules-supported-per-user") {} + + ~ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", + [value description]); + if (error != nil) { + LogNSError( + "DoorLock NumberOfYearDaySchedulesSupportedPerUser read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() + : SubscribeAttribute("number-of-year-day-schedules-supported-per-user") {} + + ~SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ChildRoleCount + * Attribute NumberOfHolidaySchedulesSupported */ -class ReadThreadNetworkDiagnosticsChildRoleCount : public ReadAttribute { +class ReadDoorLockNumberOfHolidaySchedulesSupported : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsChildRoleCount() - : ReadAttribute("child-role-count") - { - } - - ~ReadThreadNetworkDiagnosticsChildRoleCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000000F) on endpoint %u", endpointId); + ReadDoorLockNumberOfHolidaySchedulesSupported() + : ReadAttribute("number-of-holiday-schedules-supported") {} + + ~ReadDoorLockNumberOfHolidaySchedulesSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfHolidaySchedulesSupportedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock NumberOfHolidaySchedulesSupported read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() + : SubscribeAttribute("number-of-holiday-schedules-supported") {} + + ~SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeNumberOfHolidaySchedulesSupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeChildRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ChildRoleCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute MaxPINCodeLength + */ +class ReadDoorLockMaxPINCodeLength : public ReadAttribute { +public: + ReadDoorLockMaxPINCodeLength() : ReadAttribute("max-pincode-length") {} + + ~ReadDoorLockMaxPINCodeLength() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxPINCodeLengthWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock MaxPINCodeLength read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockMaxPINCodeLength : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() - : SubscribeAttribute("child-role-count") - { - } + SubscribeAttributeDoorLockMaxPINCodeLength() + : SubscribeAttribute("max-pincode-length") {} - ~SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() {} + ~SubscribeAttributeDoorLockMaxPINCodeLength() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxPINCodeLengthWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeChildRoleCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RouterRoleCount + * Attribute MinPINCodeLength */ -class ReadThreadNetworkDiagnosticsRouterRoleCount : public ReadAttribute { +class ReadDoorLockMinPINCodeLength : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRouterRoleCount() - : ReadAttribute("router-role-count") - { - } - - ~ReadThreadNetworkDiagnosticsRouterRoleCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRouterRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RouterRoleCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockMinPINCodeLength() : ReadAttribute("min-pincode-length") {} + + ~ReadDoorLockMinPINCodeLength() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinPINCodeLengthWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock MinPINCodeLength read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockMinPINCodeLength : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() - : SubscribeAttribute("router-role-count") - { - } + SubscribeAttributeDoorLockMinPINCodeLength() + : SubscribeAttribute("min-pincode-length") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() {} + ~SubscribeAttributeDoorLockMinPINCodeLength() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinPINCodeLengthWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRouterRoleCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute LeaderRoleCount + * Attribute MaxRFIDCodeLength */ -class ReadThreadNetworkDiagnosticsLeaderRoleCount : public ReadAttribute { +class ReadDoorLockMaxRFIDCodeLength : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsLeaderRoleCount() - : ReadAttribute("leader-role-count") - { - } - - ~ReadThreadNetworkDiagnosticsLeaderRoleCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLeaderRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics LeaderRoleCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockMaxRFIDCodeLength() : ReadAttribute("max-rfidcode-length") {} + + ~ReadDoorLockMaxRFIDCodeLength() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock MaxRFIDCodeLength read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockMaxRFIDCodeLength : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() - : SubscribeAttribute("leader-role-count") - { - } + SubscribeAttributeDoorLockMaxRFIDCodeLength() + : SubscribeAttribute("max-rfidcode-length") {} - ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() {} + ~SubscribeAttributeDoorLockMaxRFIDCodeLength() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxRFIDCodeLengthWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLeaderRoleCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttachAttemptCount + * Attribute MinRFIDCodeLength */ -class ReadThreadNetworkDiagnosticsAttachAttemptCount : public ReadAttribute { +class ReadDoorLockMinRFIDCodeLength : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsAttachAttemptCount() - : ReadAttribute("attach-attempt-count") - { - } - - ~ReadThreadNetworkDiagnosticsAttachAttemptCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttachAttemptCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics AttachAttemptCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockMinRFIDCodeLength() : ReadAttribute("min-rfidcode-length") {} + + ~ReadDoorLockMinRFIDCodeLength() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinRFIDCodeLengthWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock MinRFIDCodeLength read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockMinRFIDCodeLength : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() - : SubscribeAttribute("attach-attempt-count") - { - } + SubscribeAttributeDoorLockMinRFIDCodeLength() + : SubscribeAttribute("min-rfidcode-length") {} - ~SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() {} + ~SubscribeAttributeDoorLockMinRFIDCodeLength() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinRFIDCodeLengthWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttachAttemptCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PartitionIdChangeCount + * Attribute CredentialRulesSupport */ -class ReadThreadNetworkDiagnosticsPartitionIdChangeCount : public ReadAttribute { +class ReadDoorLockCredentialRulesSupport : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsPartitionIdChangeCount() - : ReadAttribute("partition-id-change-count") - { - } - - ~ReadThreadNetworkDiagnosticsPartitionIdChangeCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePartitionIdChangeCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics PartitionIdChangeCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockCredentialRulesSupport() + : ReadAttribute("credential-rules-support") {} + + ~ReadDoorLockCredentialRulesSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCredentialRulesSupportWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.CredentialRulesSupport response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock CredentialRulesSupport read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockCredentialRulesSupport + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockCredentialRulesSupport() + : SubscribeAttribute("credential-rules-support") {} + + ~SubscribeAttributeDoorLockCredentialRulesSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCredentialRulesSupportWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.CredentialRulesSupport response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount : public SubscribeAttribute { +/* + * Attribute NumberOfCredentialsSupportedPerUser + */ +class ReadDoorLockNumberOfCredentialsSupportedPerUser : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() - : SubscribeAttribute("partition-id-change-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePartitionIdChangeCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadDoorLockNumberOfCredentialsSupportedPerUser() + : ReadAttribute("number-of-credentials-supported-per-user") {} + + ~ReadDoorLockNumberOfCredentialsSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfCredentialsSupportedPerUserWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock NumberOfCredentialsSupportedPerUser read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() + : SubscribeAttribute("number-of-credentials-supported-per-user") {} + + ~SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeNumberOfCredentialsSupportedPerUserWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BetterPartitionAttachAttemptCount + * Attribute Language */ -class ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public ReadAttribute { +class ReadDoorLockLanguage : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() - : ReadAttribute("better-partition-attach-attempt-count") - { - } - - ~ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() {} + ReadDoorLockLanguage() : ReadAttribute("language") {} + + ~ReadDoorLockLanguage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLanguageWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.Language response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock Language read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000014) on endpoint %u", endpointId); +class WriteDoorLockLanguage : public WriteAttribute { +public: + WriteDoorLockLanguage() : WriteAttribute("language") { + AddArgument("attr-name", "language"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockLanguage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeLanguageWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock Language write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeBetterPartitionAttachAttemptCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics BetterPartitionAttachAttemptCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockLanguage : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() - : SubscribeAttribute("better-partition-attach-attempt-count") - { - } + SubscribeAttributeDoorLockLanguage() : SubscribeAttribute("language") {} - ~SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() {} + ~SubscribeAttributeDoorLockLanguage() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLanguageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBetterPartitionAttachAttemptCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.Language response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ParentChangeCount + * Attribute LEDSettings */ -class ReadThreadNetworkDiagnosticsParentChangeCount : public ReadAttribute { +class ReadDoorLockLEDSettings : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsParentChangeCount() - : ReadAttribute("parent-change-count") - { - } - - ~ReadThreadNetworkDiagnosticsParentChangeCount() {} + ReadDoorLockLEDSettings() : ReadAttribute("ledsettings") {} + + ~ReadDoorLockLEDSettings() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLEDSettingsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LEDSettings response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock LEDSettings read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000015) on endpoint %u", endpointId); +class WriteDoorLockLEDSettings : public WriteAttribute { +public: + WriteDoorLockLEDSettings() : WriteAttribute("ledsettings") { + AddArgument("attr-name", "ledsettings"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockLEDSettings() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeLEDSettingsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock LEDSettings write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeParentChangeCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ParentChangeCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockLEDSettings : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() - : SubscribeAttribute("parent-change-count") - { - } + SubscribeAttributeDoorLockLEDSettings() : SubscribeAttribute("ledsettings") {} - ~SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() {} + ~SubscribeAttributeDoorLockLEDSettings() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLEDSettingsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeParentChangeCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LEDSettings response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxTotalCount + * Attribute AutoRelockTime */ -class ReadThreadNetworkDiagnosticsTxTotalCount : public ReadAttribute { +class ReadDoorLockAutoRelockTime : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxTotalCount() - : ReadAttribute("tx-total-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxTotalCount() {} + ReadDoorLockAutoRelockTime() : ReadAttribute("auto-relock-time") {} + + ~ReadDoorLockAutoRelockTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000023) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAutoRelockTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock AutoRelockTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000016) on endpoint %u", endpointId); +class WriteDoorLockAutoRelockTime : public WriteAttribute { +public: + WriteDoorLockAutoRelockTime() : WriteAttribute("auto-relock-time") { + AddArgument("attr-name", "auto-relock-time"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockAutoRelockTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeAutoRelockTimeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock AutoRelockTime " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxTotalCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxTotalCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockAutoRelockTime : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() - : SubscribeAttribute("tx-total-count") - { - } + SubscribeAttributeDoorLockAutoRelockTime() + : SubscribeAttribute("auto-relock-time") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() {} + ~SubscribeAttributeDoorLockAutoRelockTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAutoRelockTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxTotalCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxUnicastCount + * Attribute SoundVolume */ -class ReadThreadNetworkDiagnosticsTxUnicastCount : public ReadAttribute { +class ReadDoorLockSoundVolume : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxUnicastCount() - : ReadAttribute("tx-unicast-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxUnicastCount() {} + ReadDoorLockSoundVolume() : ReadAttribute("sound-volume") {} + + ~ReadDoorLockSoundVolume() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSoundVolumeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SoundVolume response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock SoundVolume read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000017) on endpoint %u", endpointId); +class WriteDoorLockSoundVolume : public WriteAttribute { +public: + WriteDoorLockSoundVolume() : WriteAttribute("sound-volume") { + AddArgument("attr-name", "sound-volume"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockSoundVolume() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeSoundVolumeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock SoundVolume write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxUnicastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxUnicastCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockSoundVolume : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() - : SubscribeAttribute("tx-unicast-count") - { - } + SubscribeAttributeDoorLockSoundVolume() + : SubscribeAttribute("sound-volume") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() {} + ~SubscribeAttributeDoorLockSoundVolume() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSoundVolumeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxUnicastCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SoundVolume response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxBroadcastCount + * Attribute OperatingMode */ -class ReadThreadNetworkDiagnosticsTxBroadcastCount : public ReadAttribute { +class ReadDoorLockOperatingMode : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxBroadcastCount() - : ReadAttribute("tx-broadcast-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxBroadcastCount() {} + ReadDoorLockOperatingMode() : ReadAttribute("operating-mode") {} + + ~ReadDoorLockOperatingMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOperatingModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.OperatingMode response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock OperatingMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000018) on endpoint %u", endpointId); +class WriteDoorLockOperatingMode : public WriteAttribute { +public: + WriteDoorLockOperatingMode() : WriteAttribute("operating-mode") { + AddArgument("attr-name", "operating-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockOperatingMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOperatingModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock OperatingMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxBroadcastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxBroadcastCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockOperatingMode : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() - : SubscribeAttribute("tx-broadcast-count") - { - } + SubscribeAttributeDoorLockOperatingMode() + : SubscribeAttribute("operating-mode") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() {} + ~SubscribeAttributeDoorLockOperatingMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOperatingModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxBroadcastCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.OperatingMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxAckRequestedCount + * Attribute SupportedOperatingModes */ -class ReadThreadNetworkDiagnosticsTxAckRequestedCount : public ReadAttribute { +class ReadDoorLockSupportedOperatingModes : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxAckRequestedCount() - : ReadAttribute("tx-ack-requested-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxAckRequestedCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxAckRequestedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxAckRequestedCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockSupportedOperatingModes() + : ReadAttribute("supported-operating-modes") {} + + ~ReadDoorLockSupportedOperatingModes() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000026) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedOperatingModesWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SupportedOperatingModes response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock SupportedOperatingModes read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockSupportedOperatingModes + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockSupportedOperatingModes() + : SubscribeAttribute("supported-operating-modes") {} + + ~SubscribeAttributeDoorLockSupportedOperatingModes() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedOperatingModesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SupportedOperatingModes response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount : public SubscribeAttribute { +/* + * Attribute DefaultConfigurationRegister + */ +class ReadDoorLockDefaultConfigurationRegister : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() - : SubscribeAttribute("tx-ack-requested-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTxAckRequestedCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadDoorLockDefaultConfigurationRegister() + : ReadAttribute("default-configuration-register") {} + + ~ReadDoorLockDefaultConfigurationRegister() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000027) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDefaultConfigurationRegisterWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DefaultConfigurationRegister response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock DefaultConfigurationRegister read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockDefaultConfigurationRegister + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockDefaultConfigurationRegister() + : SubscribeAttribute("default-configuration-register") {} + + ~SubscribeAttributeDoorLockDefaultConfigurationRegister() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDefaultConfigurationRegisterWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.DefaultConfigurationRegister response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute TxAckedCount + * Attribute EnableLocalProgramming */ -class ReadThreadNetworkDiagnosticsTxAckedCount : public ReadAttribute { +class ReadDoorLockEnableLocalProgramming : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxAckedCount() - : ReadAttribute("tx-acked-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxAckedCount() {} + ReadDoorLockEnableLocalProgramming() + : ReadAttribute("enable-local-programming") {} + + ~ReadDoorLockEnableLocalProgramming() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000028) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnableLocalProgrammingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableLocalProgramming response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock EnableLocalProgramming read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001A) on endpoint %u", endpointId); +class WriteDoorLockEnableLocalProgramming : public WriteAttribute { +public: + WriteDoorLockEnableLocalProgramming() + : WriteAttribute("enable-local-programming") { + AddArgument("attr-name", "enable-local-programming"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockEnableLocalProgramming() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeEnableLocalProgrammingWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock " + "EnableLocalProgrammi" + "ng write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxAckedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxAckedCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockEnableLocalProgramming + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() - : SubscribeAttribute("tx-acked-count") - { - } + SubscribeAttributeDoorLockEnableLocalProgramming() + : SubscribeAttribute("enable-local-programming") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() {} + ~SubscribeAttributeDoorLockEnableLocalProgramming() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnableLocalProgrammingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxAckedCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableLocalProgramming response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxNoAckRequestedCount + * Attribute EnableOneTouchLocking */ -class ReadThreadNetworkDiagnosticsTxNoAckRequestedCount : public ReadAttribute { +class ReadDoorLockEnableOneTouchLocking : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() - : ReadAttribute("tx-no-ack-requested-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() {} + ReadDoorLockEnableOneTouchLocking() + : ReadAttribute("enable-one-touch-locking") {} + + ~ReadDoorLockEnableOneTouchLocking() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnableOneTouchLockingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock EnableOneTouchLocking read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001B) on endpoint %u", endpointId); +class WriteDoorLockEnableOneTouchLocking : public WriteAttribute { +public: + WriteDoorLockEnableOneTouchLocking() + : WriteAttribute("enable-one-touch-locking") { + AddArgument("attr-name", "enable-one-touch-locking"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockEnableOneTouchLocking() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeEnableOneTouchLockingWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock " + "EnableOneTouchLocking" + " write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxNoAckRequestedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxNoAckRequestedCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockEnableOneTouchLocking + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() - : SubscribeAttribute("tx-no-ack-requested-count") - { - } + SubscribeAttributeDoorLockEnableOneTouchLocking() + : SubscribeAttribute("enable-one-touch-locking") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() {} + ~SubscribeAttributeDoorLockEnableOneTouchLocking() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnableOneTouchLockingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxNoAckRequestedCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableOneTouchLocking response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxDataCount + * Attribute EnableInsideStatusLED */ -class ReadThreadNetworkDiagnosticsTxDataCount : public ReadAttribute { +class ReadDoorLockEnableInsideStatusLED : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxDataCount() - : ReadAttribute("tx-data-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxDataCount() {} + ReadDoorLockEnableInsideStatusLED() + : ReadAttribute("enable-inside-status-led") {} + + ~ReadDoorLockEnableInsideStatusLED() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnableInsideStatusLEDWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableInsideStatusLED response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock EnableInsideStatusLED read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001C) on endpoint %u", endpointId); +class WriteDoorLockEnableInsideStatusLED : public WriteAttribute { +public: + WriteDoorLockEnableInsideStatusLED() + : WriteAttribute("enable-inside-status-led") { + AddArgument("attr-name", "enable-inside-status-led"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockEnableInsideStatusLED() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeEnableInsideStatusLEDWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock " + "EnableInsideStatusLED" + " write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxDataCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxDataCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxDataCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockEnableInsideStatusLED + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() - : SubscribeAttribute("tx-data-count") - { - } + SubscribeAttributeDoorLockEnableInsideStatusLED() + : SubscribeAttribute("enable-inside-status-led") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() {} + ~SubscribeAttributeDoorLockEnableInsideStatusLED() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnableInsideStatusLEDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxDataCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnableInsideStatusLED response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxDataPollCount + * Attribute EnablePrivacyModeButton */ -class ReadThreadNetworkDiagnosticsTxDataPollCount : public ReadAttribute { +class ReadDoorLockEnablePrivacyModeButton : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxDataPollCount() - : ReadAttribute("tx-data-poll-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxDataPollCount() {} + ReadDoorLockEnablePrivacyModeButton() + : ReadAttribute("enable-privacy-mode-button") {} + + ~ReadDoorLockEnablePrivacyModeButton() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnablePrivacyModeButtonWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnablePrivacyModeButton response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock EnablePrivacyModeButton read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001D) on endpoint %u", endpointId); +class WriteDoorLockEnablePrivacyModeButton : public WriteAttribute { +public: + WriteDoorLockEnablePrivacyModeButton() + : WriteAttribute("enable-privacy-mode-button") { + AddArgument("attr-name", "enable-privacy-mode-button"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockEnablePrivacyModeButton() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeEnablePrivacyModeButtonWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("DoorLock " + "EnablePrivacyModeBu" + "tton write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxDataPollCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxDataPollCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockEnablePrivacyModeButton + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() - : SubscribeAttribute("tx-data-poll-count") - { - } + SubscribeAttributeDoorLockEnablePrivacyModeButton() + : SubscribeAttribute("enable-privacy-mode-button") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() {} + ~SubscribeAttributeDoorLockEnablePrivacyModeButton() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnablePrivacyModeButtonWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxDataPollCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.EnablePrivacyModeButton response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxBeaconCount + * Attribute LocalProgrammingFeatures */ -class ReadThreadNetworkDiagnosticsTxBeaconCount : public ReadAttribute { +class ReadDoorLockLocalProgrammingFeatures : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxBeaconCount() - : ReadAttribute("tx-beacon-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxBeaconCount() {} + ReadDoorLockLocalProgrammingFeatures() + : ReadAttribute("local-programming-features") {} + + ~ReadDoorLockLocalProgrammingFeatures() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000002C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocalProgrammingFeaturesWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LocalProgrammingFeatures response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock LocalProgrammingFeatures read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001E) on endpoint %u", endpointId); +class WriteDoorLockLocalProgrammingFeatures : public WriteAttribute { +public: + WriteDoorLockLocalProgrammingFeatures() + : WriteAttribute("local-programming-features") { + AddArgument("attr-name", "local-programming-features"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockLocalProgrammingFeatures() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x0000002C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeLocalProgrammingFeaturesWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock " + "LocalProgrammingFeatures " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxBeaconCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxBeaconCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockLocalProgrammingFeatures + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() - : SubscribeAttribute("tx-beacon-count") - { - } + SubscribeAttributeDoorLockLocalProgrammingFeatures() + : SubscribeAttribute("local-programming-features") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() {} + ~SubscribeAttributeDoorLockLocalProgrammingFeatures() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000002C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocalProgrammingFeaturesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxBeaconCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.LocalProgrammingFeatures response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxBeaconRequestCount + * Attribute WrongCodeEntryLimit */ -class ReadThreadNetworkDiagnosticsTxBeaconRequestCount : public ReadAttribute { +class ReadDoorLockWrongCodeEntryLimit : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxBeaconRequestCount() - : ReadAttribute("tx-beacon-request-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxBeaconRequestCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000001F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxBeaconRequestCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxBeaconRequestCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockWrongCodeEntryLimit() : ReadAttribute("wrong-code-entry-limit") {} + + ~ReadDoorLockWrongCodeEntryLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWrongCodeEntryLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock WrongCodeEntryLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount : public SubscribeAttribute { +class WriteDoorLockWrongCodeEntryLimit : public WriteAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() - : SubscribeAttribute("tx-beacon-request-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000001F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTxBeaconRequestCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + WriteDoorLockWrongCodeEntryLimit() + : WriteAttribute("wrong-code-entry-limit") { + AddArgument("attr-name", "wrong-code-entry-limit"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockWrongCodeEntryLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeWrongCodeEntryLimitWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock WrongCodeEntryLimit " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -/* - * Attribute TxOtherCount - */ -class ReadThreadNetworkDiagnosticsTxOtherCount : public ReadAttribute { +class SubscribeAttributeDoorLockWrongCodeEntryLimit + : public SubscribeAttribute { public: - ReadThreadNetworkDiagnosticsTxOtherCount() - : ReadAttribute("tx-other-count") - { - } + SubscribeAttributeDoorLockWrongCodeEntryLimit() + : SubscribeAttribute("wrong-code-entry-limit") {} - ~ReadThreadNetworkDiagnosticsTxOtherCount() {} + ~SubscribeAttributeDoorLockWrongCodeEntryLimit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxOtherCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount : public SubscribeAttribute { -public: - SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() - : SubscribeAttribute("tx-other-count") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWrongCodeEntryLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxOtherCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.WrongCodeEntryLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxRetryCount + * Attribute UserCodeTemporaryDisableTime */ -class ReadThreadNetworkDiagnosticsTxRetryCount : public ReadAttribute { +class ReadDoorLockUserCodeTemporaryDisableTime : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxRetryCount() - : ReadAttribute("tx-retry-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxRetryCount() {} + ReadDoorLockUserCodeTemporaryDisableTime() + : ReadAttribute("user-code-temporary-disable-time") {} + + ~ReadDoorLockUserCodeTemporaryDisableTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock UserCodeTemporaryDisableTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000021) on endpoint %u", endpointId); +class WriteDoorLockUserCodeTemporaryDisableTime : public WriteAttribute { +public: + WriteDoorLockUserCodeTemporaryDisableTime() + : WriteAttribute("user-code-temporary-disable-time") { + AddArgument("attr-name", "user-code-temporary-disable-time"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockUserCodeTemporaryDisableTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeUserCodeTemporaryDisableTimeWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock " + "UserCodeTemporaryDisa" + "bleTime write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxRetryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxRetryCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockUserCodeTemporaryDisableTime + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() - : SubscribeAttribute("tx-retry-count") - { - } + SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() + : SubscribeAttribute("user-code-temporary-disable-time") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() {} + ~SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUserCodeTemporaryDisableTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxRetryCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxDirectMaxRetryExpiryCount + * Attribute SendPINOverTheAir */ -class ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public ReadAttribute { +class ReadDoorLockSendPINOverTheAir : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() - : ReadAttribute("tx-direct-max-retry-expiry-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() {} + ReadDoorLockSendPINOverTheAir() : ReadAttribute("send-pinover-the-air") {} + + ~ReadDoorLockSendPINOverTheAir() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSendPINOverTheAirWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock SendPINOverTheAir read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000022) on endpoint %u", endpointId); +class WriteDoorLockSendPINOverTheAir : public WriteAttribute { +public: + WriteDoorLockSendPINOverTheAir() : WriteAttribute("send-pinover-the-air") { + AddArgument("attr-name", "send-pinover-the-air"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockSendPINOverTheAir() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeSendPINOverTheAirWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock SendPINOverTheAir " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxDirectMaxRetryExpiryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxDirectMaxRetryExpiryCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockSendPINOverTheAir : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() - : SubscribeAttribute("tx-direct-max-retry-expiry-count") - { - } + SubscribeAttributeDoorLockSendPINOverTheAir() + : SubscribeAttribute("send-pinover-the-air") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() {} + ~SubscribeAttributeDoorLockSendPINOverTheAir() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSendPINOverTheAirWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxDirectMaxRetryExpiryCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxIndirectMaxRetryExpiryCount + * Attribute RequirePINforRemoteOperation */ -class ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public ReadAttribute { +class ReadDoorLockRequirePINforRemoteOperation : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() - : ReadAttribute("tx-indirect-max-retry-expiry-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() {} + ReadDoorLockRequirePINforRemoteOperation() + : ReadAttribute("require-pinfor-remote-operation") {} + + ~ReadDoorLockRequirePINforRemoteOperation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000033) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", + [value description]); + if (error != nil) { + LogNSError("DoorLock RequirePINforRemoteOperation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000023) on endpoint %u", endpointId); +class WriteDoorLockRequirePINforRemoteOperation : public WriteAttribute { +public: + WriteDoorLockRequirePINforRemoteOperation() + : WriteAttribute("require-pinfor-remote-operation") { + AddArgument("attr-name", "require-pinfor-remote-operation"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockRequirePINforRemoteOperation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeRequirePINforRemoteOperationWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock " + "RequirePINforRemoteOp" + "eration write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxIndirectMaxRetryExpiryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxIndirectMaxRetryExpiryCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + bool mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockRequirePINforRemoteOperation + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() - : SubscribeAttribute("tx-indirect-max-retry-expiry-count") - { - } + SubscribeAttributeDoorLockRequirePINforRemoteOperation() + : SubscribeAttribute("require-pinfor-remote-operation") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() {} + ~SubscribeAttributeDoorLockRequirePINforRemoteOperation() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRequirePINforRemoteOperationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxIndirectMaxRetryExpiryCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxErrCcaCount + * Attribute ExpiringUserTimeout */ -class ReadThreadNetworkDiagnosticsTxErrCcaCount : public ReadAttribute { +class ReadDoorLockExpiringUserTimeout : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxErrCcaCount() - : ReadAttribute("tx-err-cca-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxErrCcaCount() {} + ReadDoorLockExpiringUserTimeout() : ReadAttribute("expiring-user-timeout") {} + + ~ReadDoorLockExpiringUserTimeout() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x00000035) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeExpiringUserTimeoutWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ExpiringUserTimeout response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock ExpiringUserTimeout read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000024) on endpoint %u", endpointId); +class WriteDoorLockExpiringUserTimeout : public WriteAttribute { +public: + WriteDoorLockExpiringUserTimeout() : WriteAttribute("expiring-user-timeout") { + AddArgument("attr-name", "expiring-user-timeout"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDoorLockExpiringUserTimeout() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) WriteAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeExpiringUserTimeoutWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "DoorLock ExpiringUserTimeout " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxErrCcaCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxErrCcaCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockExpiringUserTimeout + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() - : SubscribeAttribute("tx-err-cca-count") - { - } + SubscribeAttributeDoorLockExpiringUserTimeout() + : SubscribeAttribute("expiring-user-timeout") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() {} + ~SubscribeAttributeDoorLockExpiringUserTimeout() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExpiringUserTimeoutWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxErrCcaCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ExpiringUserTimeout response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxErrAbortCount + * Attribute GeneratedCommandList */ -class ReadThreadNetworkDiagnosticsTxErrAbortCount : public ReadAttribute { +class ReadDoorLockGeneratedCommandList : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxErrAbortCount() - : ReadAttribute("tx-err-abort-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxErrAbortCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxErrAbortCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxErrAbortCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadDoorLockGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeDoorLockGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadDoorLockAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() - : SubscribeAttribute("tx-err-abort-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTxErrAbortCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadDoorLockAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadDoorLockAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDoorLockAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeDoorLockAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeDoorLockAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute TxErrBusyChannelCount + * Attribute AttributeList */ -class ReadThreadNetworkDiagnosticsTxErrBusyChannelCount : public ReadAttribute { +class ReadDoorLockAttributeList : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() - : ReadAttribute("tx-err-busy-channel-count") - { - } - - ~ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxErrBusyChannelCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics TxErrBusyChannelCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadDoorLockAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockAttributeList : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() - : SubscribeAttribute("tx-err-busy-channel-count") - { - } + SubscribeAttributeDoorLockAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() {} + ~SubscribeAttributeDoorLockAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxErrBusyChannelCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RxTotalCount + * Attribute FeatureMap */ -class ReadThreadNetworkDiagnosticsRxTotalCount : public ReadAttribute { +class ReadDoorLockFeatureMap : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxTotalCount() - : ReadAttribute("rx-total-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxTotalCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000027) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxTotalCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxTotalCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadDoorLockFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"DoorLock.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() - : SubscribeAttribute("rx-total-count") - { - } + SubscribeAttributeDoorLockFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() {} + ~SubscribeAttributeDoorLockFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRxTotalCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RxUnicastCount + * Attribute ClusterRevision */ -class ReadThreadNetworkDiagnosticsRxUnicastCount : public ReadAttribute { +class ReadDoorLockClusterRevision : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxUnicastCount() - : ReadAttribute("rx-unicast-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxUnicastCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000028) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxUnicastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxUnicastCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadDoorLockClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadDoorLockClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("DoorLock ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount : public SubscribeAttribute { +class SubscribeAttributeDoorLockClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() - : SubscribeAttribute("rx-unicast-count") - { - } + SubscribeAttributeDoorLockClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxUnicastCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeDoorLockClusterRevision() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000101) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterDoorLock alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -/* - * Attribute RxBroadcastCount - */ -class ReadThreadNetworkDiagnosticsRxBroadcastCount : public ReadAttribute { -public: - ReadThreadNetworkDiagnosticsRxBroadcastCount() - : ReadAttribute("rx-broadcast-count") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"DoorLock.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - ~ReadThreadNetworkDiagnosticsRxBroadcastCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000029) on endpoint %u", endpointId); + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxBroadcastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxBroadcastCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster WindowCovering | 0x0102 | +|------------------------------------------------------------------------------| +| Commands: | | +| * UpOrOpen | 0x00 | +| * DownOrClose | 0x01 | +| * StopMotion | 0x02 | +| * GoToLiftValue | 0x04 | +| * GoToLiftPercentage | 0x05 | +| * GoToTiltValue | 0x07 | +| * GoToTiltPercentage | 0x08 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Type | 0x0000 | +| * PhysicalClosedLimitLift | 0x0001 | +| * PhysicalClosedLimitTilt | 0x0002 | +| * CurrentPositionLift | 0x0003 | +| * CurrentPositionTilt | 0x0004 | +| * NumberOfActuationsLift | 0x0005 | +| * NumberOfActuationsTilt | 0x0006 | +| * ConfigStatus | 0x0007 | +| * CurrentPositionLiftPercentage | 0x0008 | +| * CurrentPositionTiltPercentage | 0x0009 | +| * OperationalStatus | 0x000A | +| * TargetPositionLiftPercent100ths | 0x000B | +| * TargetPositionTiltPercent100ths | 0x000C | +| * EndProductType | 0x000D | +| * CurrentPositionLiftPercent100ths | 0x000E | +| * CurrentPositionTiltPercent100ths | 0x000F | +| * InstalledOpenLimitLift | 0x0010 | +| * InstalledClosedLimitLift | 0x0011 | +| * InstalledOpenLimitTilt | 0x0012 | +| * InstalledClosedLimitTilt | 0x0013 | +| * Mode | 0x0017 | +| * SafetyStatus | 0x001A | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ -class SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount : public SubscribeAttribute { +/* + * Command UpOrOpen + */ +class WindowCoveringUpOrOpen : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() - : SubscribeAttribute("rx-broadcast-count") - { + WindowCoveringUpOrOpen() : ClusterCommand("up-or-open") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWindowCoveringClusterUpOrOpenParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster upOrOpenWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxBroadcastCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute RxDataCount + * Command DownOrClose */ -class ReadThreadNetworkDiagnosticsRxDataCount : public ReadAttribute { +class WindowCoveringDownOrClose : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsRxDataCount() - : ReadAttribute("rx-data-count") - { + WindowCoveringDownOrClose() : ClusterCommand("down-or-close") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterDownOrCloseParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster downOrCloseWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsRxDataCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxDataCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxDataCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributeThreadNetworkDiagnosticsRxDataCount : public SubscribeAttribute { +/* + * Command StopMotion + */ +class WindowCoveringStopMotion : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() - : SubscribeAttribute("rx-data-count") - { + WindowCoveringStopMotion() : ClusterCommand("stop-motion") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterStopMotionParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopMotionWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxDataCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute RxDataPollCount + * Command GoToLiftValue */ -class ReadThreadNetworkDiagnosticsRxDataPollCount : public ReadAttribute { +class WindowCoveringGoToLiftValue : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsRxDataPollCount() - : ReadAttribute("rx-data-poll-count") - { + WindowCoveringGoToLiftValue() : ClusterCommand("go-to-lift-value") { + AddArgument("LiftValue", 0, UINT16_MAX, &mRequest.liftValue); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterGoToLiftValueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.liftValue = [NSNumber numberWithUnsignedShort:mRequest.liftValue]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster goToLiftValueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsRxDataPollCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxDataPollCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxDataPollCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount : public SubscribeAttribute { +/* + * Command GoToLiftPercentage + */ +class WindowCoveringGoToLiftPercentage : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() - : SubscribeAttribute("rx-data-poll-count") - { + WindowCoveringGoToLiftPercentage() : ClusterCommand("go-to-lift-percentage") { + AddArgument("LiftPercent100thsValue", 0, UINT16_MAX, + &mRequest.liftPercent100thsValue); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterGoToLiftPercentageParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.liftPercent100thsValue = + [NSNumber numberWithUnsignedShort:mRequest.liftPercent100thsValue]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster goToLiftPercentageWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxDataPollCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type + mRequest; }; /* - * Attribute RxBeaconCount + * Command GoToTiltValue */ -class ReadThreadNetworkDiagnosticsRxBeaconCount : public ReadAttribute { +class WindowCoveringGoToTiltValue : public ClusterCommand { public: - ReadThreadNetworkDiagnosticsRxBeaconCount() - : ReadAttribute("rx-beacon-count") - { + WindowCoveringGoToTiltValue() : ClusterCommand("go-to-tilt-value") { + AddArgument("TiltValue", 0, UINT16_MAX, &mRequest.tiltValue); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterGoToTiltValueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.tiltValue = [NSNumber numberWithUnsignedShort:mRequest.tiltValue]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster goToTiltValueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadThreadNetworkDiagnosticsRxBeaconCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxBeaconCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxBeaconCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Type mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount : public SubscribeAttribute { +/* + * Command GoToTiltPercentage + */ +class WindowCoveringGoToTiltPercentage : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() - : SubscribeAttribute("rx-beacon-count") - { + WindowCoveringGoToTiltPercentage() : ClusterCommand("go-to-tilt-percentage") { + AddArgument("TiltPercent100thsValue", 0, UINT16_MAX, + &mRequest.tiltPercent100thsValue); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000102) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRWindowCoveringClusterGoToTiltPercentageParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.tiltPercent100thsValue = + [NSNumber numberWithUnsignedShort:mRequest.tiltPercent100thsValue]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster goToTiltPercentageWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxBeaconCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type + mRequest; }; /* - * Attribute RxBeaconRequestCount + * Attribute Type */ -class ReadThreadNetworkDiagnosticsRxBeaconRequestCount : public ReadAttribute { +class ReadWindowCoveringType : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxBeaconRequestCount() - : ReadAttribute("rx-beacon-request-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxBeaconRequestCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxBeaconRequestCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxBeaconRequestCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringType() : ReadAttribute("type") {} + + ~ReadWindowCoveringType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTypeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WindowCovering.Type response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering Type read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount : public SubscribeAttribute { +class SubscribeAttributeWindowCoveringType : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() - : SubscribeAttribute("rx-beacon-request-count") - { - } + SubscribeAttributeWindowCoveringType() : SubscribeAttribute("type") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() {} + ~SubscribeAttributeWindowCoveringType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRxBeaconRequestCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.Type response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RxOtherCount + * Attribute PhysicalClosedLimitLift */ -class ReadThreadNetworkDiagnosticsRxOtherCount : public ReadAttribute { +class ReadWindowCoveringPhysicalClosedLimitLift : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxOtherCount() - : ReadAttribute("rx-other-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxOtherCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxOtherCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringPhysicalClosedLimitLift() + : ReadAttribute("physical-closed-limit-lift") {} + + ~ReadWindowCoveringPhysicalClosedLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePhysicalClosedLimitLiftWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering PhysicalClosedLimitLift read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringPhysicalClosedLimitLift + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() + : SubscribeAttribute("physical-closed-limit-lift") {} + + ~SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePhysicalClosedLimitLiftWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount : public SubscribeAttribute { +/* + * Attribute PhysicalClosedLimitTilt + */ +class ReadWindowCoveringPhysicalClosedLimitTilt : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() - : SubscribeAttribute("rx-other-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxOtherCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWindowCoveringPhysicalClosedLimitTilt() + : ReadAttribute("physical-closed-limit-tilt") {} + + ~ReadWindowCoveringPhysicalClosedLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePhysicalClosedLimitTiltWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering PhysicalClosedLimitTilt read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() + : SubscribeAttribute("physical-closed-limit-tilt") {} + + ~SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePhysicalClosedLimitTiltWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxAddressFilteredCount + * Attribute CurrentPositionLift */ -class ReadThreadNetworkDiagnosticsRxAddressFilteredCount : public ReadAttribute { +class ReadWindowCoveringCurrentPositionLift : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxAddressFilteredCount() - : ReadAttribute("rx-address-filtered-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxAddressFilteredCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000002F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxAddressFilteredCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxAddressFilteredCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringCurrentPositionLift() + : ReadAttribute("current-position-lift") {} + + ~ReadWindowCoveringCurrentPositionLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionLiftWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLift response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionLift read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionLift + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionLift() + : SubscribeAttribute("current-position-lift") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionLiftWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLift response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount : public SubscribeAttribute { +/* + * Attribute CurrentPositionTilt + */ +class ReadWindowCoveringCurrentPositionTilt : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() - : SubscribeAttribute("rx-address-filtered-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() {} + ReadWindowCoveringCurrentPositionTilt() + : ReadAttribute("current-position-tilt") {} + + ~ReadWindowCoveringCurrentPositionTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionTiltWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTilt response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionTilt read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionTilt + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionTilt() + : SubscribeAttribute("current-position-tilt") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionTiltWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTilt response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000002F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxAddressFilteredCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute NumberOfActuationsLift + */ +class ReadWindowCoveringNumberOfActuationsLift : public ReadAttribute { +public: + ReadWindowCoveringNumberOfActuationsLift() + : ReadAttribute("number-of-actuations-lift") {} + + ~ReadWindowCoveringNumberOfActuationsLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfActuationsLiftWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.NumberOfActuationsLift response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering NumberOfActuationsLift read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringNumberOfActuationsLift + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringNumberOfActuationsLift() + : SubscribeAttribute("number-of-actuations-lift") {} + + ~SubscribeAttributeWindowCoveringNumberOfActuationsLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfActuationsLiftWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.NumberOfActuationsLift response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxDestAddrFilteredCount + * Attribute NumberOfActuationsTilt */ -class ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount : public ReadAttribute { +class ReadWindowCoveringNumberOfActuationsTilt : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() - : ReadAttribute("rx-dest-addr-filtered-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000030) on endpoint %u", endpointId); + ReadWindowCoveringNumberOfActuationsTilt() + : ReadAttribute("number-of-actuations-tilt") {} + + ~ReadWindowCoveringNumberOfActuationsTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfActuationsTiltWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering NumberOfActuationsTilt read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringNumberOfActuationsTilt + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringNumberOfActuationsTilt() + : SubscribeAttribute("number-of-actuations-tilt") {} + + ~SubscribeAttributeWindowCoveringNumberOfActuationsTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfActuationsTiltWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxDestAddrFilteredCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxDestAddrFilteredCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ConfigStatus + */ +class ReadWindowCoveringConfigStatus : public ReadAttribute { +public: + ReadWindowCoveringConfigStatus() : ReadAttribute("config-status") {} + + ~ReadWindowCoveringConfigStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeConfigStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering ConfigStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount : public SubscribeAttribute { +class SubscribeAttributeWindowCoveringConfigStatus : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() - : SubscribeAttribute("rx-dest-addr-filtered-count") - { - } + SubscribeAttributeWindowCoveringConfigStatus() + : SubscribeAttribute("config-status") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() {} + ~SubscribeAttributeWindowCoveringConfigStatus() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeConfigStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRxDestAddrFilteredCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.ConfigStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RxDuplicatedCount + * Attribute CurrentPositionLiftPercentage */ -class ReadThreadNetworkDiagnosticsRxDuplicatedCount : public ReadAttribute { +class ReadWindowCoveringCurrentPositionLiftPercentage : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxDuplicatedCount() - : ReadAttribute("rx-duplicated-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxDuplicatedCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxDuplicatedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxDuplicatedCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringCurrentPositionLiftPercentage() + : ReadAttribute("current-position-lift-percentage") {} + + ~ReadWindowCoveringCurrentPositionLiftPercentage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionLiftPercentageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionLiftPercentage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() + : SubscribeAttribute("current-position-lift-percentage") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionLiftPercentageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount : public SubscribeAttribute { +/* + * Attribute CurrentPositionTiltPercentage + */ +class ReadWindowCoveringCurrentPositionTiltPercentage : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() - : SubscribeAttribute("rx-duplicated-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxDuplicatedCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWindowCoveringCurrentPositionTiltPercentage() + : ReadAttribute("current-position-tilt-percentage") {} + + ~ReadWindowCoveringCurrentPositionTiltPercentage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionTiltPercentageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionTiltPercentage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() + : SubscribeAttribute("current-position-tilt-percentage") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionTiltPercentageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrNoFrameCount + * Attribute OperationalStatus */ -class ReadThreadNetworkDiagnosticsRxErrNoFrameCount : public ReadAttribute { +class ReadWindowCoveringOperationalStatus : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrNoFrameCount() - : ReadAttribute("rx-err-no-frame-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrNoFrameCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrNoFrameCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrNoFrameCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringOperationalStatus() : ReadAttribute("operational-status") {} + + ~ReadWindowCoveringOperationalStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOperationalStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.OperationalStatus response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering OperationalStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringOperationalStatus + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringOperationalStatus() + : SubscribeAttribute("operational-status") {} + + ~SubscribeAttributeWindowCoveringOperationalStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOperationalStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.OperationalStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount : public SubscribeAttribute { +/* + * Attribute TargetPositionLiftPercent100ths + */ +class ReadWindowCoveringTargetPositionLiftPercent100ths : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() - : SubscribeAttribute("rx-err-no-frame-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxErrNoFrameCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWindowCoveringTargetPositionLiftPercent100ths() + : ReadAttribute("target-position-lift-percent100ths") {} + + ~ReadWindowCoveringTargetPositionLiftPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTargetPositionLiftPercent100thsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering TargetPositionLiftPercent100ths read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() + : SubscribeAttribute("target-position-lift-percent100ths") {} + + ~SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTargetPositionLiftPercent100thsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrUnknownNeighborCount + * Attribute TargetPositionTiltPercent100ths */ -class ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public ReadAttribute { +class ReadWindowCoveringTargetPositionTiltPercent100ths : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() - : ReadAttribute("rx-err-unknown-neighbor-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000033) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrUnknownNeighborCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrUnknownNeighborCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringTargetPositionTiltPercent100ths() + : ReadAttribute("target-position-tilt-percent100ths") {} + + ~ReadWindowCoveringTargetPositionTiltPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTargetPositionTiltPercent100thsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering TargetPositionTiltPercent100ths read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() + : SubscribeAttribute("target-position-tilt-percent100ths") {} + + ~SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTargetPositionTiltPercent100thsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public SubscribeAttribute { +/* + * Attribute EndProductType + */ +class ReadWindowCoveringEndProductType : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() - : SubscribeAttribute("rx-err-unknown-neighbor-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() {} + ReadWindowCoveringEndProductType() : ReadAttribute("end-product-type") {} + + ~ReadWindowCoveringEndProductType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEndProductTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.EndProductType response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering EndProductType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringEndProductType + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringEndProductType() + : SubscribeAttribute("end-product-type") {} + + ~SubscribeAttributeWindowCoveringEndProductType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEndProductTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.EndProductType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxErrUnknownNeighborCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute CurrentPositionLiftPercent100ths + */ +class ReadWindowCoveringCurrentPositionLiftPercent100ths + : public ReadAttribute { +public: + ReadWindowCoveringCurrentPositionLiftPercent100ths() + : ReadAttribute("current-position-lift-percent100ths") {} + + ~ReadWindowCoveringCurrentPositionLiftPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionLiftPercent100thsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionLiftPercent100ths read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() + : SubscribeAttribute("current-position-lift-percent100ths") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionLiftPercent100thsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute CurrentPositionTiltPercent100ths + */ +class ReadWindowCoveringCurrentPositionTiltPercent100ths + : public ReadAttribute { +public: + ReadWindowCoveringCurrentPositionTiltPercent100ths() + : ReadAttribute("current-position-tilt-percent100ths") {} + + ~ReadWindowCoveringCurrentPositionTiltPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentPositionTiltPercent100thsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering CurrentPositionTiltPercent100ths read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() + : SubscribeAttribute("current-position-tilt-percent100ths") {} + + ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPositionTiltPercent100thsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrInvalidSrcAddrCount + * Attribute InstalledOpenLimitLift */ -class ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public ReadAttribute { +class ReadWindowCoveringInstalledOpenLimitLift : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() - : ReadAttribute("rx-err-invalid-src-addr-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000034) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrInvalidSrcAddrCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringInstalledOpenLimitLift() + : ReadAttribute("installed-open-limit-lift") {} + + ~ReadWindowCoveringInstalledOpenLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstalledOpenLimitLiftWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering InstalledOpenLimitLift read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringInstalledOpenLimitLift + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringInstalledOpenLimitLift() + : SubscribeAttribute("installed-open-limit-lift") {} + + ~SubscribeAttributeWindowCoveringInstalledOpenLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstalledOpenLimitLiftWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public SubscribeAttribute { +/* + * Attribute InstalledClosedLimitLift + */ +class ReadWindowCoveringInstalledClosedLimitLift : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() - : SubscribeAttribute("rx-err-invalid-src-addr-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxErrInvalidSrcAddrCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWindowCoveringInstalledClosedLimitLift() + : ReadAttribute("installed-closed-limit-lift") {} + + ~ReadWindowCoveringInstalledClosedLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstalledClosedLimitLiftWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering InstalledClosedLimitLift read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringInstalledClosedLimitLift + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringInstalledClosedLimitLift() + : SubscribeAttribute("installed-closed-limit-lift") {} + + ~SubscribeAttributeWindowCoveringInstalledClosedLimitLift() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstalledClosedLimitLiftWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrSecCount + * Attribute InstalledOpenLimitTilt */ -class ReadThreadNetworkDiagnosticsRxErrSecCount : public ReadAttribute { +class ReadWindowCoveringInstalledOpenLimitTilt : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrSecCount() - : ReadAttribute("rx-err-sec-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrSecCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000035) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrSecCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrSecCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringInstalledOpenLimitTilt() + : ReadAttribute("installed-open-limit-tilt") {} + + ~ReadWindowCoveringInstalledOpenLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstalledOpenLimitTiltWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering InstalledOpenLimitTilt read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringInstalledOpenLimitTilt + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() + : SubscribeAttribute("installed-open-limit-tilt") {} + + ~SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstalledOpenLimitTiltWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount : public SubscribeAttribute { +/* + * Attribute InstalledClosedLimitTilt + */ +class ReadWindowCoveringInstalledClosedLimitTilt : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() - : SubscribeAttribute("rx-err-sec-count") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRxErrSecCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadWindowCoveringInstalledClosedLimitTilt() + : ReadAttribute("installed-closed-limit-tilt") {} + + ~ReadWindowCoveringInstalledClosedLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstalledClosedLimitTiltWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering InstalledClosedLimitTilt read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringInstalledClosedLimitTilt + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() + : SubscribeAttribute("installed-closed-limit-tilt") {} + + ~SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstalledClosedLimitTiltWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrFcsCount + * Attribute Mode */ -class ReadThreadNetworkDiagnosticsRxErrFcsCount : public ReadAttribute { +class ReadWindowCoveringMode : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrFcsCount() - : ReadAttribute("rx-err-fcs-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrFcsCount() {} + ReadWindowCoveringMode() : ReadAttribute("mode") {} + + ~ReadWindowCoveringMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeModeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WindowCovering.Mode response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering Mode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000036) on endpoint %u", endpointId); +class WriteWindowCoveringMode : public WriteAttribute { +public: + WriteWindowCoveringMode() : WriteAttribute("mode") { + AddArgument("attr-name", "mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteWindowCoveringMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) WriteAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("WindowCovering Mode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrFcsCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrFcsCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount : public SubscribeAttribute { +class SubscribeAttributeWindowCoveringMode : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() - : SubscribeAttribute("rx-err-fcs-count") - { - } + SubscribeAttributeWindowCoveringMode() : SubscribeAttribute("mode") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() {} + ~SubscribeAttributeWindowCoveringMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000036) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRxErrFcsCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.Mode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RxErrOtherCount + * Attribute SafetyStatus */ -class ReadThreadNetworkDiagnosticsRxErrOtherCount : public ReadAttribute { +class ReadWindowCoveringSafetyStatus : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsRxErrOtherCount() - : ReadAttribute("rx-err-other-count") - { - } - - ~ReadThreadNetworkDiagnosticsRxErrOtherCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000037) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRxErrOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics RxErrOtherCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWindowCoveringSafetyStatus() : ReadAttribute("safety-status") {} + + ~ReadWindowCoveringSafetyStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSafetyStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering SafetyStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount : public SubscribeAttribute { +class SubscribeAttributeWindowCoveringSafetyStatus : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() - : SubscribeAttribute("rx-err-other-count") - { - } + SubscribeAttributeWindowCoveringSafetyStatus() + : SubscribeAttribute("safety-status") {} - ~SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() {} + ~SubscribeAttributeWindowCoveringSafetyStatus() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000037) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSafetyStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRxErrOtherCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.SafetyStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveTimestamp + * Attribute GeneratedCommandList */ -class ReadThreadNetworkDiagnosticsActiveTimestamp : public ReadAttribute { +class ReadWindowCoveringGeneratedCommandList : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsActiveTimestamp() - : ReadAttribute("active-timestamp") - { - } + ReadWindowCoveringGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadWindowCoveringGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeWindowCoveringGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadThreadNetworkDiagnosticsActiveTimestamp() {} +/* + * Attribute AcceptedCommandList + */ +class ReadWindowCoveringAcceptedCommandList : public ReadAttribute { +public: + ReadWindowCoveringAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadWindowCoveringAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("WindowCovering AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeWindowCoveringAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000038) on endpoint %u", endpointId); +/* + * Attribute AttributeList + */ +class ReadWindowCoveringAttributeList : public ReadAttribute { +public: + ReadWindowCoveringAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadWindowCoveringAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeWindowCoveringAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ActiveTimestamp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadWindowCoveringFeatureMap : public ReadAttribute { +public: + ReadWindowCoveringFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadWindowCoveringFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WindowCovering.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp : public SubscribeAttribute { +class SubscribeAttributeWindowCoveringFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() - : SubscribeAttribute("active-timestamp") - { - } + SubscribeAttributeWindowCoveringFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() {} + ~SubscribeAttributeWindowCoveringFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000038) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveTimestampWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PendingTimestamp + * Attribute ClusterRevision */ -class ReadThreadNetworkDiagnosticsPendingTimestamp : public ReadAttribute { +class ReadWindowCoveringClusterRevision : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsPendingTimestamp() - : ReadAttribute("pending-timestamp") - { - } + ReadWindowCoveringClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadWindowCoveringClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("WindowCovering ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWindowCoveringClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeWindowCoveringClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeWindowCoveringClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000102) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWindowCovering alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WindowCovering.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadThreadNetworkDiagnosticsPendingTimestamp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x00000039) on endpoint %u", endpointId); +/*----------------------------------------------------------------------------*\ +| Cluster BarrierControl | 0x0103 | +|------------------------------------------------------------------------------| +| Commands: | | +| * BarrierControlGoToPercent | 0x00 | +| * BarrierControlStop | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * BarrierMovingState | 0x0001 | +| * BarrierSafetyStatus | 0x0002 | +| * BarrierCapabilities | 0x0003 | +| * BarrierOpenEvents | 0x0004 | +| * BarrierCloseEvents | 0x0005 | +| * BarrierCommandOpenEvents | 0x0006 | +| * BarrierCommandCloseEvents | 0x0007 | +| * BarrierOpenPeriod | 0x0008 | +| * BarrierClosePeriod | 0x0009 | +| * BarrierPosition | 0x000A | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePendingTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics PendingTimestamp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command BarrierControlGoToPercent + */ +class BarrierControlBarrierControlGoToPercent : public ClusterCommand { +public: + BarrierControlBarrierControlGoToPercent() + : ClusterCommand("barrier-control-go-to-percent") { + AddArgument("PercentOpen", 0, UINT8_MAX, &mRequest.percentOpen); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000103) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRBarrierControlClusterBarrierControlGoToPercentParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.percentOpen = [NSNumber numberWithUnsignedChar:mRequest.percentOpen]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster barrierControlGoToPercentWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::BarrierControl::Commands::BarrierControlGoToPercent::Type + mRequest; }; -class SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp : public SubscribeAttribute { +/* + * Command BarrierControlStop + */ +class BarrierControlBarrierControlStop : public ClusterCommand { public: - SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() - : SubscribeAttribute("pending-timestamp") - { + BarrierControlBarrierControlStop() : ClusterCommand("barrier-control-stop") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000103) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRBarrierControlClusterBarrierControlStopParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster barrierControlStopWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() {} +private: +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x00000039) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePendingTimestampWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute BarrierMovingState + */ +class ReadBarrierControlBarrierMovingState : public ReadAttribute { +public: + ReadBarrierControlBarrierMovingState() + : ReadAttribute("barrier-moving-state") {} + + ~ReadBarrierControlBarrierMovingState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierMovingStateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierMovingState response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierMovingState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlBarrierMovingState + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlBarrierMovingState() + : SubscribeAttribute("barrier-moving-state") {} + + ~SubscribeAttributeBarrierControlBarrierMovingState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierMovingStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierMovingState response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute BarrierSafetyStatus + */ +class ReadBarrierControlBarrierSafetyStatus : public ReadAttribute { +public: + ReadBarrierControlBarrierSafetyStatus() + : ReadAttribute("barrier-safety-status") {} + + ~ReadBarrierControlBarrierSafetyStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierSafetyStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierSafetyStatus response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierSafetyStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlBarrierSafetyStatus + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlBarrierSafetyStatus() + : SubscribeAttribute("barrier-safety-status") {} + + ~SubscribeAttributeBarrierControlBarrierSafetyStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierSafetyStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierSafetyStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Delay + * Attribute BarrierCapabilities */ -class ReadThreadNetworkDiagnosticsDelay : public ReadAttribute { +class ReadBarrierControlBarrierCapabilities : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsDelay() - : ReadAttribute("delay") - { - } + ReadBarrierControlBarrierCapabilities() + : ReadAttribute("barrier-capabilities") {} + + ~ReadBarrierControlBarrierCapabilities() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierCapabilitiesWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCapabilities response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierCapabilities read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlBarrierCapabilities + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlBarrierCapabilities() + : SubscribeAttribute("barrier-capabilities") {} + + ~SubscribeAttributeBarrierControlBarrierCapabilities() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierCapabilitiesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCapabilities response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadThreadNetworkDiagnosticsDelay() {} +/* + * Attribute BarrierOpenEvents + */ +class ReadBarrierControlBarrierOpenEvents : public ReadAttribute { +public: + ReadBarrierControlBarrierOpenEvents() + : ReadAttribute("barrier-open-events") {} + + ~ReadBarrierControlBarrierOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierOpenEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierOpenEvents response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierOpenEvents read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000003A) on endpoint %u", endpointId); +class WriteBarrierControlBarrierOpenEvents : public WriteAttribute { +public: + WriteBarrierControlBarrierOpenEvents() + : WriteAttribute("barrier-open-events") { + AddArgument("attr-name", "barrier-open-events"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierOpenEventsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierOpenEvents write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics Delay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsDelay : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierOpenEvents + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsDelay() - : SubscribeAttribute("delay") - { - } + SubscribeAttributeBarrierControlBarrierOpenEvents() + : SubscribeAttribute("barrier-open-events") {} - ~SubscribeAttributeThreadNetworkDiagnosticsDelay() {} + ~SubscribeAttributeBarrierControlBarrierOpenEvents() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000003A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierOpenEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierOpenEvents response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SecurityPolicy + * Attribute BarrierCloseEvents */ -class ReadThreadNetworkDiagnosticsSecurityPolicy : public ReadAttribute { +class ReadBarrierControlBarrierCloseEvents : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsSecurityPolicy() - : ReadAttribute("security-policy") - { - } - - ~ReadThreadNetworkDiagnosticsSecurityPolicy() {} + ReadBarrierControlBarrierCloseEvents() + : ReadAttribute("barrier-close-events") {} + + ~ReadBarrierControlBarrierCloseEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierCloseEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCloseEvents response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierCloseEvents read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000003B) on endpoint %u", endpointId); +class WriteBarrierControlBarrierCloseEvents : public WriteAttribute { +public: + WriteBarrierControlBarrierCloseEvents() + : WriteAttribute("barrier-close-events") { + AddArgument("attr-name", "barrier-close-events"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierCloseEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierCloseEventsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierCloseEvents write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSecurityPolicyWithCompletion:^( - MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics SecurityPolicy read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierCloseEvents + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() - : SubscribeAttribute("security-policy") - { - } + SubscribeAttributeBarrierControlBarrierCloseEvents() + : SubscribeAttribute("barrier-close-events") {} - ~SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() {} + ~SubscribeAttributeBarrierControlBarrierCloseEvents() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000003B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierCloseEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSecurityPolicyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCloseEvents response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ChannelPage0Mask + * Attribute BarrierCommandOpenEvents */ -class ReadThreadNetworkDiagnosticsChannelPage0Mask : public ReadAttribute { +class ReadBarrierControlBarrierCommandOpenEvents : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsChannelPage0Mask() - : ReadAttribute("channel-page0mask") - { - } - - ~ReadThreadNetworkDiagnosticsChannelPage0Mask() {} + ReadBarrierControlBarrierCommandOpenEvents() + : ReadAttribute("barrier-command-open-events") {} + + ~ReadBarrierControlBarrierCommandOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierCommandOpenEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCommandOpenEvents response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierCommandOpenEvents read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000003C) on endpoint %u", endpointId); +class WriteBarrierControlBarrierCommandOpenEvents : public WriteAttribute { +public: + WriteBarrierControlBarrierCommandOpenEvents() + : WriteAttribute("barrier-command-open-events") { + AddArgument("attr-name", "barrier-command-open-events"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierCommandOpenEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierCommandOpenEventsWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierCommandOpenEvents " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeChannelPage0MaskWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ChannelPage0Mask read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierCommandOpenEvents + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() - : SubscribeAttribute("channel-page0mask") - { - } + SubscribeAttributeBarrierControlBarrierCommandOpenEvents() + : SubscribeAttribute("barrier-command-open-events") {} - ~SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() {} + ~SubscribeAttributeBarrierControlBarrierCommandOpenEvents() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000003C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierCommandOpenEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeChannelPage0MaskWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCommandOpenEvents response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute OperationalDatasetComponents + * Attribute BarrierCommandCloseEvents */ -class ReadThreadNetworkDiagnosticsOperationalDatasetComponents : public ReadAttribute { +class ReadBarrierControlBarrierCommandCloseEvents : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsOperationalDatasetComponents() - : ReadAttribute("operational-dataset-components") - { - } - - ~ReadThreadNetworkDiagnosticsOperationalDatasetComponents() {} + ReadBarrierControlBarrierCommandCloseEvents() + : ReadAttribute("barrier-command-close-events") {} + + ~ReadBarrierControlBarrierCommandCloseEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierCommandCloseEventsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCommandCloseEvents response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierCommandCloseEvents read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000003D) on endpoint %u", endpointId); +class WriteBarrierControlBarrierCommandCloseEvents : public WriteAttribute { +public: + WriteBarrierControlBarrierCommandCloseEvents() + : WriteAttribute("barrier-command-close-events") { + AddArgument("attr-name", "barrier-command-close-events"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierCommandCloseEvents() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierCommandCloseEventsWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierCommandCloseEvent" + "s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOperationalDatasetComponentsWithCompletion:^( - MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics OperationalDatasetComponents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierCommandCloseEvents + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() - : SubscribeAttribute("operational-dataset-components") - { - } + SubscribeAttributeBarrierControlBarrierCommandCloseEvents() + : SubscribeAttribute("barrier-command-close-events") {} - ~SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() {} + ~SubscribeAttributeBarrierControlBarrierCommandCloseEvents() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000003D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierCommandCloseEventsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOperationalDatasetComponentsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^( - MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierCommandCloseEvents response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveNetworkFaultsList + * Attribute BarrierOpenPeriod */ -class ReadThreadNetworkDiagnosticsActiveNetworkFaultsList : public ReadAttribute { +class ReadBarrierControlBarrierOpenPeriod : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() - : ReadAttribute("active-network-faults-list") - { - } - - ~ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() {} + ReadBarrierControlBarrierOpenPeriod() + : ReadAttribute("barrier-open-period") {} + + ~ReadBarrierControlBarrierOpenPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierOpenPeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierOpenPeriod response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierOpenPeriod read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000003E) on endpoint %u", endpointId); +class WriteBarrierControlBarrierOpenPeriod : public WriteAttribute { +public: + WriteBarrierControlBarrierOpenPeriod() + : WriteAttribute("barrier-open-period") { + AddArgument("attr-name", "barrier-open-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierOpenPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierOpenPeriodWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierOpenPeriod write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveNetworkFaultsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ActiveNetworkFaultsList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierOpenPeriod + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() - : SubscribeAttribute("active-network-faults-list") - { - } + SubscribeAttributeBarrierControlBarrierOpenPeriod() + : SubscribeAttribute("barrier-open-period") {} - ~SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() {} + ~SubscribeAttributeBarrierControlBarrierOpenPeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000003E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierOpenPeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveNetworkFaultsListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierOpenPeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute BarrierClosePeriod */ -class ReadThreadNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { +class ReadBarrierControlBarrierClosePeriod : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadThreadNetworkDiagnosticsGeneratedCommandList() {} + ReadBarrierControlBarrierClosePeriod() + : ReadAttribute("barrier-close-period") {} + + ~ReadBarrierControlBarrierClosePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierClosePeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierClosePeriod response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierClosePeriod read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteBarrierControlBarrierClosePeriod : public WriteAttribute { +public: + WriteBarrierControlBarrierClosePeriod() + : WriteAttribute("barrier-close-period") { + AddArgument("attr-name", "barrier-close-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBarrierControlBarrierClosePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) WriteAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBarrierClosePeriodWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BarrierControl " + "BarrierClosePeriod write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeBarrierControlBarrierClosePeriod + : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeBarrierControlBarrierClosePeriod() + : SubscribeAttribute("barrier-close-period") {} - ~SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() {} + ~SubscribeAttributeBarrierControlBarrierClosePeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierClosePeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierClosePeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute BarrierPosition */ -class ReadThreadNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { +class ReadBarrierControlBarrierPosition : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadThreadNetworkDiagnosticsAcceptedCommandList() {} + ReadBarrierControlBarrierPosition() : ReadAttribute("barrier-position") {} + + ~ReadBarrierControlBarrierPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBarrierPositionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierPosition response %@", [value description]); + if (error != nil) { + LogNSError("BarrierControl BarrierPosition read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlBarrierPosition + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlBarrierPosition() + : SubscribeAttribute("barrier-position") {} + + ~SubscribeAttributeBarrierControlBarrierPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBarrierPositionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.BarrierPosition response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadBarrierControlGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBarrierControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBarrierControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBarrierControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute AcceptedCommandList */ -class ReadThreadNetworkDiagnosticsAttributeList : public ReadAttribute { +class ReadBarrierControlAcceptedCommandList : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadThreadNetworkDiagnosticsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBarrierControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBarrierControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BarrierControl AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBarrierControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsAttributeList : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadBarrierControlAttributeList : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBarrierControlAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBarrierControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("BarrierControl AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeBarrierControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadThreadNetworkDiagnosticsFeatureMap : public ReadAttribute { +class ReadBarrierControlFeatureMap : public ReadAttribute { public: - ReadThreadNetworkDiagnosticsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadThreadNetworkDiagnosticsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadBarrierControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBarrierControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BarrierControl.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("BarrierControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeThreadNetworkDiagnosticsFeatureMap : public SubscribeAttribute { +class SubscribeAttributeBarrierControlFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeBarrierControlFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() {} + ~SubscribeAttributeBarrierControlFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadThreadNetworkDiagnosticsClusterRevision : public ReadAttribute { -public: - ReadThreadNetworkDiagnosticsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadThreadNetworkDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ThreadNetworkDiagnostics ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThreadNetworkDiagnosticsClusterRevision : public SubscribeAttribute { +class ReadBarrierControlClusterRevision : public ReadAttribute { public: - SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000035) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadBarrierControlClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadBarrierControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("BarrierControl ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBarrierControlClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBarrierControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBarrierControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000103) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterBarrierControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BarrierControl.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster WiFiNetworkDiagnostics | 0x0036 | +| Cluster PumpConfigurationAndControl | 0x0200 | |------------------------------------------------------------------------------| | Commands: | | -| * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Bssid | 0x0000 | -| * SecurityType | 0x0001 | -| * WiFiVersion | 0x0002 | -| * ChannelNumber | 0x0003 | -| * Rssi | 0x0004 | -| * BeaconLostCount | 0x0005 | -| * BeaconRxCount | 0x0006 | -| * PacketMulticastRxCount | 0x0007 | -| * PacketMulticastTxCount | 0x0008 | -| * PacketUnicastRxCount | 0x0009 | -| * PacketUnicastTxCount | 0x000A | -| * CurrentMaxRate | 0x000B | -| * OverrunCount | 0x000C | +| * MaxPressure | 0x0000 | +| * MaxSpeed | 0x0001 | +| * MaxFlow | 0x0002 | +| * MinConstPressure | 0x0003 | +| * MaxConstPressure | 0x0004 | +| * MinCompPressure | 0x0005 | +| * MaxCompPressure | 0x0006 | +| * MinConstSpeed | 0x0007 | +| * MaxConstSpeed | 0x0008 | +| * MinConstFlow | 0x0009 | +| * MaxConstFlow | 0x000A | +| * MinConstTemp | 0x000B | +| * MaxConstTemp | 0x000C | +| * PumpStatus | 0x0010 | +| * EffectiveOperationMode | 0x0011 | +| * EffectiveControlMode | 0x0012 | +| * Capacity | 0x0013 | +| * Speed | 0x0014 | +| * LifetimeRunningHours | 0x0015 | +| * Power | 0x0016 | +| * LifetimeEnergyConsumed | 0x0017 | +| * OperationMode | 0x0020 | +| * ControlMode | 0x0021 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -28177,3847 +54026,8720 @@ class SubscribeAttributeThreadNetworkDiagnosticsClusterRevision : public Subscri | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * Disconnection | 0x0000 | -| * AssociationFailure | 0x0001 | -| * ConnectionStatus | 0x0002 | +| * SupplyVoltageLow | 0x0000 | +| * SupplyVoltageHigh | 0x0001 | +| * PowerMissingPhase | 0x0002 | +| * SystemPressureLow | 0x0003 | +| * SystemPressureHigh | 0x0004 | +| * DryRunning | 0x0005 | +| * MotorTemperatureHigh | 0x0006 | +| * PumpMotorFatalFailure | 0x0007 | +| * ElectronicTemperatureHigh | 0x0008 | +| * PumpBlocked | 0x0009 | +| * SensorFailure | 0x000A | +| * ElectronicNonFatalFailure | 0x000B | +| * ElectronicFatalFailure | 0x000C | +| * GeneralFault | 0x000D | +| * Leakage | 0x000E | +| * AirDetection | 0x000F | +| * TurbineOperation | 0x0010 | \*----------------------------------------------------------------------------*/ /* - * Command ResetCounts + * Attribute MaxPressure */ -class WiFiNetworkDiagnosticsResetCounts : public ClusterCommand { +class ReadPumpConfigurationAndControlMaxPressure : public ReadAttribute { public: - WiFiNetworkDiagnosticsResetCounts() - : ClusterCommand("reset-counts") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWiFiNetworkDiagnosticsClusterResetCountsParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster resetCountsWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: + ReadPumpConfigurationAndControlMaxPressure() + : ReadAttribute("max-pressure") {} + + ~ReadPumpConfigurationAndControlMaxPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxPressureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxPressure read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxPressure + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxPressure() + : SubscribeAttribute("max-pressure") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxPressureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute Bssid + * Attribute MaxSpeed */ -class ReadWiFiNetworkDiagnosticsBssid : public ReadAttribute { +class ReadPumpConfigurationAndControlMaxSpeed : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsBssid() - : ReadAttribute("bssid") - { - } - - ~ReadWiFiNetworkDiagnosticsBssid() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBssidWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.Bssid response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics Bssid read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxSpeed() : ReadAttribute("max-speed") {} + + ~ReadPumpConfigurationAndControlMaxSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxSpeedWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxSpeed read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxSpeed + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxSpeed() + : SubscribeAttribute("max-speed") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxSpeedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsBssid : public SubscribeAttribute { +/* + * Attribute MaxFlow + */ +class ReadPumpConfigurationAndControlMaxFlow : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsBssid() - : SubscribeAttribute("bssid") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsBssid() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBssidWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.Bssid response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxFlow() : ReadAttribute("max-flow") {} + + ~ReadPumpConfigurationAndControlMaxFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxFlowWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxFlow read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxFlow + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxFlow() + : SubscribeAttribute("max-flow") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxFlowWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SecurityType + * Attribute MinConstPressure */ -class ReadWiFiNetworkDiagnosticsSecurityType : public ReadAttribute { +class ReadPumpConfigurationAndControlMinConstPressure : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsSecurityType() - : ReadAttribute("security-type") - { - } - - ~ReadWiFiNetworkDiagnosticsSecurityType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSecurityTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics SecurityType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMinConstPressure() + : ReadAttribute("min-const-pressure") {} + + ~ReadPumpConfigurationAndControlMinConstPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinConstPressureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MinConstPressure read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMinConstPressure + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMinConstPressure() + : SubscribeAttribute("min-const-pressure") {} + + ~SubscribeAttributePumpConfigurationAndControlMinConstPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinConstPressureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsSecurityType : public SubscribeAttribute { +/* + * Attribute MaxConstPressure + */ +class ReadPumpConfigurationAndControlMaxConstPressure : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() - : SubscribeAttribute("security-type") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSecurityTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxConstPressure() + : ReadAttribute("max-const-pressure") {} + + ~ReadPumpConfigurationAndControlMaxConstPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxConstPressureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxConstPressure read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxConstPressure + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxConstPressure() + : SubscribeAttribute("max-const-pressure") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxConstPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxConstPressureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute WiFiVersion + * Attribute MinCompPressure */ -class ReadWiFiNetworkDiagnosticsWiFiVersion : public ReadAttribute { +class ReadPumpConfigurationAndControlMinCompPressure : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsWiFiVersion() - : ReadAttribute("wi-fi-version") - { - } - - ~ReadWiFiNetworkDiagnosticsWiFiVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWiFiVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics WiFiVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMinCompPressure() + : ReadAttribute("min-comp-pressure") {} + + ~ReadPumpConfigurationAndControlMinCompPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinCompPressureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MinCompPressure read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMinCompPressure + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMinCompPressure() + : SubscribeAttribute("min-comp-pressure") {} + + ~SubscribeAttributePumpConfigurationAndControlMinCompPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinCompPressureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion : public SubscribeAttribute { +/* + * Attribute MaxCompPressure + */ +class ReadPumpConfigurationAndControlMaxCompPressure : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() - : SubscribeAttribute("wi-fi-version") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWiFiVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxCompPressure() + : ReadAttribute("max-comp-pressure") {} + + ~ReadPumpConfigurationAndControlMaxCompPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxCompPressureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxCompPressure read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxCompPressure + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxCompPressure() + : SubscribeAttribute("max-comp-pressure") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxCompPressure() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxCompPressureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ChannelNumber + * Attribute MinConstSpeed */ -class ReadWiFiNetworkDiagnosticsChannelNumber : public ReadAttribute { +class ReadPumpConfigurationAndControlMinConstSpeed : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsChannelNumber() - : ReadAttribute("channel-number") - { - } - - ~ReadWiFiNetworkDiagnosticsChannelNumber() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeChannelNumberWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics ChannelNumber read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMinConstSpeed() + : ReadAttribute("min-const-speed") {} + + ~ReadPumpConfigurationAndControlMinConstSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinConstSpeedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MinConstSpeed read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMinConstSpeed + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMinConstSpeed() + : SubscribeAttribute("min-const-speed") {} + + ~SubscribeAttributePumpConfigurationAndControlMinConstSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinConstSpeedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber : public SubscribeAttribute { +/* + * Attribute MaxConstSpeed + */ +class ReadPumpConfigurationAndControlMaxConstSpeed : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() - : SubscribeAttribute("channel-number") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeChannelNumberWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; + ReadPumpConfigurationAndControlMaxConstSpeed() + : ReadAttribute("max-const-speed") {} + + ~ReadPumpConfigurationAndControlMaxConstSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxConstSpeedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxConstSpeed read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxConstSpeed + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() + : SubscribeAttribute("max-const-speed") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxConstSpeedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; /* - * Attribute Rssi + * Attribute MinConstFlow */ -class ReadWiFiNetworkDiagnosticsRssi : public ReadAttribute { +class ReadPumpConfigurationAndControlMinConstFlow : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsRssi() - : ReadAttribute("rssi") - { - } - - ~ReadWiFiNetworkDiagnosticsRssi() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRssiWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.Rssi response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics Rssi read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMinConstFlow() + : ReadAttribute("min-const-flow") {} + + ~ReadPumpConfigurationAndControlMinConstFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinConstFlowWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MinConstFlow read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMinConstFlow + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMinConstFlow() + : SubscribeAttribute("min-const-flow") {} + + ~SubscribeAttributePumpConfigurationAndControlMinConstFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinConstFlowWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsRssi : public SubscribeAttribute { +/* + * Attribute MaxConstFlow + */ +class ReadPumpConfigurationAndControlMaxConstFlow : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsRssi() - : SubscribeAttribute("rssi") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsRssi() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRssiWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.Rssi response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxConstFlow() + : ReadAttribute("max-const-flow") {} + + ~ReadPumpConfigurationAndControlMaxConstFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxConstFlowWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxConstFlow read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxConstFlow + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxConstFlow() + : SubscribeAttribute("max-const-flow") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxConstFlow() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxConstFlowWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BeaconLostCount + * Attribute MinConstTemp */ -class ReadWiFiNetworkDiagnosticsBeaconLostCount : public ReadAttribute { +class ReadPumpConfigurationAndControlMinConstTemp : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsBeaconLostCount() - : ReadAttribute("beacon-lost-count") - { - } - - ~ReadWiFiNetworkDiagnosticsBeaconLostCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBeaconLostCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics BeaconLostCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMinConstTemp() + : ReadAttribute("min-const-temp") {} + + ~ReadPumpConfigurationAndControlMinConstTemp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinConstTempWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MinConstTemp read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMinConstTemp + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMinConstTemp() + : SubscribeAttribute("min-const-temp") {} + + ~SubscribeAttributePumpConfigurationAndControlMinConstTemp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinConstTempWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount : public SubscribeAttribute { +/* + * Attribute MaxConstTemp + */ +class ReadPumpConfigurationAndControlMaxConstTemp : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() - : SubscribeAttribute("beacon-lost-count") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBeaconLostCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlMaxConstTemp() + : ReadAttribute("max-const-temp") {} + + ~ReadPumpConfigurationAndControlMaxConstTemp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxConstTempWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl MaxConstTemp read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlMaxConstTemp + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlMaxConstTemp() + : SubscribeAttribute("max-const-temp") {} + + ~SubscribeAttributePumpConfigurationAndControlMaxConstTemp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxConstTempWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute BeaconRxCount + * Attribute PumpStatus */ -class ReadWiFiNetworkDiagnosticsBeaconRxCount : public ReadAttribute { +class ReadPumpConfigurationAndControlPumpStatus : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsBeaconRxCount() - : ReadAttribute("beacon-rx-count") - { - } - - ~ReadWiFiNetworkDiagnosticsBeaconRxCount() {} + ReadPumpConfigurationAndControlPumpStatus() : ReadAttribute("pump-status") {} + + ~ReadPumpConfigurationAndControlPumpStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePumpStatusWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl PumpStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlPumpStatus + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlPumpStatus() + : SubscribeAttribute("pump-status") {} + + ~SubscribeAttributePumpConfigurationAndControlPumpStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePumpStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000006) on endpoint %u", endpointId); +/* + * Attribute EffectiveOperationMode + */ +class ReadPumpConfigurationAndControlEffectiveOperationMode + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlEffectiveOperationMode() + : ReadAttribute("effective-operation-mode") {} + + ~ReadPumpConfigurationAndControlEffectiveOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEffectiveOperationModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", + [value description]); + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl EffectiveOperationMode read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() + : SubscribeAttribute("effective-operation-mode") {} + + ~SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEffectiveOperationModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"PumpConfigurationAndControl.EffectiveOperationMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBeaconRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics BeaconRxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute EffectiveControlMode + */ +class ReadPumpConfigurationAndControlEffectiveControlMode + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlEffectiveControlMode() + : ReadAttribute("effective-control-mode") {} + + ~ReadPumpConfigurationAndControlEffectiveControlMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEffectiveControlModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", + [value description]); + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl EffectiveControlMode read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlEffectiveControlMode + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() + : SubscribeAttribute("effective-control-mode") {} + + ~SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEffectiveControlModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount : public SubscribeAttribute { +/* + * Attribute Capacity + */ +class ReadPumpConfigurationAndControlCapacity : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() - : SubscribeAttribute("beacon-rx-count") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBeaconRxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlCapacity() : ReadAttribute("capacity") {} + + ~ReadPumpConfigurationAndControlCapacity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCapacityWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Capacity response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl Capacity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlCapacity + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlCapacity() + : SubscribeAttribute("capacity") {} + + ~SubscribeAttributePumpConfigurationAndControlCapacity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCapacityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Capacity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketMulticastRxCount + * Attribute Speed */ -class ReadWiFiNetworkDiagnosticsPacketMulticastRxCount : public ReadAttribute { +class ReadPumpConfigurationAndControlSpeed : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() - : ReadAttribute("packet-multicast-rx-count") - { - } - - ~ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() {} + ReadPumpConfigurationAndControlSpeed() : ReadAttribute("speed") {} + + ~ReadPumpConfigurationAndControlSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSpeedWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Speed response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl Speed read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlSpeed + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlSpeed() + : SubscribeAttribute("speed") {} + + ~SubscribeAttributePumpConfigurationAndControlSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSpeedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Speed response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000007) on endpoint %u", endpointId); +/* + * Attribute LifetimeRunningHours + */ +class ReadPumpConfigurationAndControlLifetimeRunningHours + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlLifetimeRunningHours() + : ReadAttribute("lifetime-running-hours") {} + + ~ReadPumpConfigurationAndControlLifetimeRunningHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLifetimeRunningHoursWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", + [value description]); + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl LifetimeRunningHours read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WritePumpConfigurationAndControlLifetimeRunningHours + : public WriteAttribute { +public: + WritePumpConfigurationAndControlLifetimeRunningHours() + : WriteAttribute("lifetime-running-hours") { + AddArgument("attr-name", "lifetime-running-hours"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WritePumpConfigurationAndControlLifetimeRunningHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) WriteAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeLifetimeRunningHoursWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl " + "LifetimeRunningHours write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketMulticastRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics PacketMulticastRxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount : public SubscribeAttribute { +class SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours + : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() - : SubscribeAttribute("packet-multicast-rx-count") - { - } + SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() + : SubscribeAttribute("lifetime-running-hours") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() {} + ~SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLifetimeRunningHoursWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketMulticastRxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketMulticastTxCount + * Attribute Power */ -class ReadWiFiNetworkDiagnosticsPacketMulticastTxCount : public ReadAttribute { +class ReadPumpConfigurationAndControlPower : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() - : ReadAttribute("packet-multicast-tx-count") - { - } - - ~ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() {} + ReadPumpConfigurationAndControlPower() : ReadAttribute("power") {} + + ~ReadPumpConfigurationAndControlPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Power response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl Power read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlPower + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlPower() + : SubscribeAttribute("power") {} + + ~SubscribeAttributePumpConfigurationAndControlPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.Power response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000008) on endpoint %u", endpointId); +/* + * Attribute LifetimeEnergyConsumed + */ +class ReadPumpConfigurationAndControlLifetimeEnergyConsumed + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlLifetimeEnergyConsumed() + : ReadAttribute("lifetime-energy-consumed") {} + + ~ReadPumpConfigurationAndControlLifetimeEnergyConsumed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLifetimeEnergyConsumedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", + [value description]); + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl LifetimeEnergyConsumed read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WritePumpConfigurationAndControlLifetimeEnergyConsumed + : public WriteAttribute { +public: + WritePumpConfigurationAndControlLifetimeEnergyConsumed() + : WriteAttribute("lifetime-energy-consumed") { + AddArgument("attr-name", "lifetime-energy-consumed"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WritePumpConfigurationAndControlLifetimeEnergyConsumed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) WriteAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeLifetimeEnergyConsumedWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl" + " LifetimeEnergyConsumed " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketMulticastTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics PacketMulticastTxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount : public SubscribeAttribute { +class SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed + : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() - : SubscribeAttribute("packet-multicast-tx-count") - { - } + SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() + : SubscribeAttribute("lifetime-energy-consumed") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() {} + ~SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLifetimeEnergyConsumedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketMulticastTxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketUnicastRxCount + * Attribute OperationMode */ -class ReadWiFiNetworkDiagnosticsPacketUnicastRxCount : public ReadAttribute { +class ReadPumpConfigurationAndControlOperationMode : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() - : ReadAttribute("packet-unicast-rx-count") - { - } - - ~ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() {} + ReadPumpConfigurationAndControlOperationMode() + : ReadAttribute("operation-mode") {} + + ~ReadPumpConfigurationAndControlOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOperationModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.OperationMode response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl OperationMode read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x00000009) on endpoint %u", endpointId); +class WritePumpConfigurationAndControlOperationMode : public WriteAttribute { +public: + WritePumpConfigurationAndControlOperationMode() + : WriteAttribute("operation-mode") { + AddArgument("attr-name", "operation-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WritePumpConfigurationAndControlOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) WriteAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOperationModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("PumpConfigurationAndControl " + "OperationMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketUnicastRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics PacketUnicastRxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount : public SubscribeAttribute { +class SubscribeAttributePumpConfigurationAndControlOperationMode + : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() - : SubscribeAttribute("packet-unicast-rx-count") - { - } + SubscribeAttributePumpConfigurationAndControlOperationMode() + : SubscribeAttribute("operation-mode") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() {} + ~SubscribeAttributePumpConfigurationAndControlOperationMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOperationModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketUnicastRxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.OperationMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketUnicastTxCount + * Attribute ControlMode */ -class ReadWiFiNetworkDiagnosticsPacketUnicastTxCount : public ReadAttribute { +class ReadPumpConfigurationAndControlControlMode : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() - : ReadAttribute("packet-unicast-tx-count") - { - } - - ~ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() {} + ReadPumpConfigurationAndControlControlMode() + : ReadAttribute("control-mode") {} + + ~ReadPumpConfigurationAndControlControlMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeControlModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.ControlMode response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl ControlMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000000A) on endpoint %u", endpointId); +class WritePumpConfigurationAndControlControlMode : public WriteAttribute { +public: + WritePumpConfigurationAndControlControlMode() + : WriteAttribute("control-mode") { + AddArgument("attr-name", "control-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WritePumpConfigurationAndControlControlMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) WriteAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeControlModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("PumpConfigurationAndContro" + "l ControlMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketUnicastTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics PacketUnicastTxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount : public SubscribeAttribute { +class SubscribeAttributePumpConfigurationAndControlControlMode + : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() - : SubscribeAttribute("packet-unicast-tx-count") - { - } + SubscribeAttributePumpConfigurationAndControlControlMode() + : SubscribeAttribute("control-mode") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() {} + ~SubscribeAttributePumpConfigurationAndControlControlMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeControlModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketUnicastTxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.ControlMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentMaxRate + * Attribute GeneratedCommandList */ -class ReadWiFiNetworkDiagnosticsCurrentMaxRate : public ReadAttribute { -public: - ReadWiFiNetworkDiagnosticsCurrentMaxRate() - : ReadAttribute("current-max-rate") - { - } - - ~ReadWiFiNetworkDiagnosticsCurrentMaxRate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentMaxRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics CurrentMaxRate read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadPumpConfigurationAndControlGeneratedCommandList + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadPumpConfigurationAndControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError( + "PumpConfigurationAndControl GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate : public SubscribeAttribute { -public: - SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() - : SubscribeAttribute("current-max-rate") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentMaxRateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadPumpConfigurationAndControlAcceptedCommandList + : public ReadAttribute { +public: + ReadPumpConfigurationAndControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadPumpConfigurationAndControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute OverrunCount + * Attribute AttributeList */ -class ReadWiFiNetworkDiagnosticsOverrunCount : public ReadAttribute { +class ReadPumpConfigurationAndControlAttributeList : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsOverrunCount() - : ReadAttribute("overrun-count") - { - } - - ~ReadWiFiNetworkDiagnosticsOverrunCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics OverrunCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadPumpConfigurationAndControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributePumpConfigurationAndControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadPumpConfigurationAndControlFeatureMap : public ReadAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() - : SubscribeAttribute("overrun-count") - { - } - - ~SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOverrunCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPumpConfigurationAndControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadPumpConfigurationAndControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributePumpConfigurationAndControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ClusterRevision */ -class ReadWiFiNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { +class ReadPumpConfigurationAndControlClusterRevision : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadWiFiNetworkDiagnosticsGeneratedCommandList() {} + ReadPumpConfigurationAndControlClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadPumpConfigurationAndControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("PumpConfigurationAndControl ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePumpConfigurationAndControlClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributePumpConfigurationAndControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributePumpConfigurationAndControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000200) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +/*----------------------------------------------------------------------------*\ +| Cluster Thermostat | 0x0201 | +|------------------------------------------------------------------------------| +| Commands: | | +| * SetpointRaiseLower | 0x00 | +| * SetWeeklySchedule | 0x01 | +| * GetWeeklySchedule | 0x02 | +| * ClearWeeklySchedule | 0x03 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * LocalTemperature | 0x0000 | +| * OutdoorTemperature | 0x0001 | +| * Occupancy | 0x0002 | +| * AbsMinHeatSetpointLimit | 0x0003 | +| * AbsMaxHeatSetpointLimit | 0x0004 | +| * AbsMinCoolSetpointLimit | 0x0005 | +| * AbsMaxCoolSetpointLimit | 0x0006 | +| * PICoolingDemand | 0x0007 | +| * PIHeatingDemand | 0x0008 | +| * HVACSystemTypeConfiguration | 0x0009 | +| * LocalTemperatureCalibration | 0x0010 | +| * OccupiedCoolingSetpoint | 0x0011 | +| * OccupiedHeatingSetpoint | 0x0012 | +| * UnoccupiedCoolingSetpoint | 0x0013 | +| * UnoccupiedHeatingSetpoint | 0x0014 | +| * MinHeatSetpointLimit | 0x0015 | +| * MaxHeatSetpointLimit | 0x0016 | +| * MinCoolSetpointLimit | 0x0017 | +| * MaxCoolSetpointLimit | 0x0018 | +| * MinSetpointDeadBand | 0x0019 | +| * RemoteSensing | 0x001A | +| * ControlSequenceOfOperation | 0x001B | +| * SystemMode | 0x001C | +| * ThermostatRunningMode | 0x001E | +| * StartOfWeek | 0x0020 | +| * NumberOfWeeklyTransitions | 0x0021 | +| * NumberOfDailyTransitions | 0x0022 | +| * TemperatureSetpointHold | 0x0023 | +| * TemperatureSetpointHoldDuration | 0x0024 | +| * ThermostatProgrammingOperationMode | 0x0025 | +| * ThermostatRunningState | 0x0029 | +| * SetpointChangeSource | 0x0030 | +| * SetpointChangeAmount | 0x0031 | +| * SetpointChangeSourceTimestamp | 0x0032 | +| * OccupiedSetback | 0x0034 | +| * OccupiedSetbackMin | 0x0035 | +| * OccupiedSetbackMax | 0x0036 | +| * UnoccupiedSetback | 0x0037 | +| * UnoccupiedSetbackMin | 0x0038 | +| * UnoccupiedSetbackMax | 0x0039 | +| * EmergencyHeatDelta | 0x003A | +| * ACType | 0x0040 | +| * ACCapacity | 0x0041 | +| * ACRefrigerantType | 0x0042 | +| * ACCompressorType | 0x0043 | +| * ACErrorCode | 0x0044 | +| * ACLouverPosition | 0x0045 | +| * ACCoilTemperature | 0x0046 | +| * ACCapacityformat | 0x0047 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command SetpointRaiseLower + */ +class ThermostatSetpointRaiseLower : public ClusterCommand { +public: + ThermostatSetpointRaiseLower() : ClusterCommand("setpoint-raise-lower") { + AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); + AddArgument("Amount", INT8_MIN, INT8_MAX, &mRequest.amount); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000201) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRThermostatClusterSetpointRaiseLowerParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.mode = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.mode)]; + params.amount = [NSNumber numberWithChar:mRequest.amount]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setpointRaiseLowerWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Type mRequest; }; -class SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { +/* + * Command SetWeeklySchedule + */ +class ThermostatSetWeeklySchedule : public ClusterCommand { public: - SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + ThermostatSetWeeklySchedule() + : ClusterCommand("set-weekly-schedule"), + mComplex_Transitions(&mRequest.transitions) { + AddArgument("NumberOfTransitionsForSequence", 0, UINT8_MAX, + &mRequest.numberOfTransitionsForSequence); + AddArgument("DayOfWeekForSequence", 0, UINT8_MAX, + &mRequest.dayOfWeekForSequence); + AddArgument("ModeForSequence", 0, UINT8_MAX, &mRequest.modeForSequence); + AddArgument("Transitions", &mComplex_Transitions); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000201) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRThermostatClusterSetWeeklyScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.numberOfTransitionsForSequence = [NSNumber + numberWithUnsignedChar:mRequest.numberOfTransitionsForSequence]; + params.dayOfWeekForSequence = + [NSNumber numberWithUnsignedChar:mRequest.dayOfWeekForSequence.Raw()]; + params.modeForSequence = + [NSNumber numberWithUnsignedChar:mRequest.modeForSequence.Raw()]; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.transitions) { + MTRThermostatClusterThermostatScheduleTransition *newElement_0; + newElement_0 = [MTRThermostatClusterThermostatScheduleTransition new]; + newElement_0.transitionTime = + [NSNumber numberWithUnsignedShort:entry_0.transitionTime]; + if (entry_0.heatSetpoint.IsNull()) { + newElement_0.heatSetpoint = nil; + } else { + newElement_0.heatSetpoint = + [NSNumber numberWithShort:entry_0.heatSetpoint.Value()]; + } + if (entry_0.coolSetpoint.IsNull()) { + newElement_0.coolSetpoint = nil; + } else { + newElement_0.coolSetpoint = + [NSNumber numberWithShort:entry_0.coolSetpoint.Value()]; + } + [array_0 addObject:newElement_0]; + } + params.transitions = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster setWeeklyScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; +private: + chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type mRequest; + TypedComplexArgument> + mComplex_Transitions; +}; - return CHIP_NO_ERROR; +/* + * Command GetWeeklySchedule + */ +class ThermostatGetWeeklySchedule : public ClusterCommand { +public: + ThermostatGetWeeklySchedule() : ClusterCommand("get-weekly-schedule") { + AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); + AddArgument("ModeToReturn", 0, UINT8_MAX, &mRequest.modeToReturn); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000201) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRThermostatClusterGetWeeklyScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.daysToReturn = + [NSNumber numberWithUnsignedChar:mRequest.daysToReturn.Raw()]; + params.modeToReturn = + [NSNumber numberWithUnsignedChar:mRequest.modeToReturn.Raw()]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getWeeklyScheduleWithParams:params + completion:^( + MTRThermostatClusterGetWeeklyScheduleResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type mRequest; }; /* - * Attribute AcceptedCommandList + * Command ClearWeeklySchedule */ -class ReadWiFiNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { +class ThermostatClearWeeklySchedule : public ClusterCommand { public: - ReadWiFiNetworkDiagnosticsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + ThermostatClearWeeklySchedule() : ClusterCommand("clear-weekly-schedule") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000201) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRThermostatClusterClearWeeklyScheduleParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearWeeklyScheduleWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadWiFiNetworkDiagnosticsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +private: +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute LocalTemperature + */ +class ReadThermostatLocalTemperature : public ReadAttribute { +public: + ReadThermostatLocalTemperature() : ReadAttribute("local-temperature") {} + + ~ReadThermostatLocalTemperature() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocalTemperatureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.LocalTemperature response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat LocalTemperature read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeThermostatLocalTemperature : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeThermostatLocalTemperature() + : SubscribeAttribute("local-temperature") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() {} + ~SubscribeAttributeThermostatLocalTemperature() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocalTemperatureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.LocalTemperature response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute OutdoorTemperature */ -class ReadWiFiNetworkDiagnosticsAttributeList : public ReadAttribute { +class ReadThermostatOutdoorTemperature : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadWiFiNetworkDiagnosticsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); + ReadThermostatOutdoorTemperature() : ReadAttribute("outdoor-temperature") {} + + ~ReadThermostatOutdoorTemperature() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOutdoorTemperatureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OutdoorTemperature response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat OutdoorTemperature read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatOutdoorTemperature + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatOutdoorTemperature() + : SubscribeAttribute("outdoor-temperature") {} + + ~SubscribeAttributeThermostatOutdoorTemperature() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOutdoorTemperatureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OutdoorTemperature response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Occupancy + */ +class ReadThermostatOccupancy : public ReadAttribute { +public: + ReadThermostatOccupancy() : ReadAttribute("occupancy") {} + + ~ReadThermostatOccupancy() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupancyWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Thermostat.Occupancy response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat Occupancy read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsAttributeList : public SubscribeAttribute { +class SubscribeAttributeThermostatOccupancy : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeThermostatOccupancy() : SubscribeAttribute("occupancy") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() {} + ~SubscribeAttributeThermostatOccupancy() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupancyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.Occupancy response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute AbsMinHeatSetpointLimit */ -class ReadWiFiNetworkDiagnosticsFeatureMap : public ReadAttribute { +class ReadThermostatAbsMinHeatSetpointLimit : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadThermostatAbsMinHeatSetpointLimit() + : ReadAttribute("abs-min-heat-setpoint-limit") {} + + ~ReadThermostatAbsMinHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAbsMinHeatSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat AbsMinHeatSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatAbsMinHeatSetpointLimit + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatAbsMinHeatSetpointLimit() + : SubscribeAttribute("abs-min-heat-setpoint-limit") {} + + ~SubscribeAttributeThermostatAbsMinHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAbsMinHeatSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadWiFiNetworkDiagnosticsFeatureMap() {} +/* + * Attribute AbsMaxHeatSetpointLimit + */ +class ReadThermostatAbsMaxHeatSetpointLimit : public ReadAttribute { +public: + ReadThermostatAbsMaxHeatSetpointLimit() + : ReadAttribute("abs-max-heat-setpoint-limit") {} + + ~ReadThermostatAbsMaxHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat AbsMaxHeatSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatAbsMaxHeatSetpointLimit + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() + : SubscribeAttribute("abs-max-heat-setpoint-limit") {} + + ~SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAbsMaxHeatSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AbsMinCoolSetpointLimit + */ +class ReadThermostatAbsMinCoolSetpointLimit : public ReadAttribute { +public: + ReadThermostatAbsMinCoolSetpointLimit() + : ReadAttribute("abs-min-cool-setpoint-limit") {} + + ~ReadThermostatAbsMinCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAbsMinCoolSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat AbsMinCoolSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatAbsMinCoolSetpointLimit + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatAbsMinCoolSetpointLimit() + : SubscribeAttribute("abs-min-cool-setpoint-limit") {} + + ~SubscribeAttributeThermostatAbsMinCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAbsMinCoolSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +/* + * Attribute AbsMaxCoolSetpointLimit + */ +class ReadThermostatAbsMaxCoolSetpointLimit : public ReadAttribute { +public: + ReadThermostatAbsMaxCoolSetpointLimit() + : ReadAttribute("abs-max-cool-setpoint-limit") {} + + ~ReadThermostatAbsMaxCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat AbsMaxCoolSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatAbsMaxCoolSetpointLimit + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() + : SubscribeAttribute("abs-max-cool-setpoint-limit") {} + + ~SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAbsMaxCoolSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute PICoolingDemand + */ +class ReadThermostatPICoolingDemand : public ReadAttribute { +public: + ReadThermostatPICoolingDemand() : ReadAttribute("picooling-demand") {} + + ~ReadThermostatPICoolingDemand() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePICoolingDemandWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat PICoolingDemand read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap : public SubscribeAttribute { +class SubscribeAttributeThermostatPICoolingDemand : public SubscribeAttribute { public: - SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeThermostatPICoolingDemand() + : SubscribeAttribute("picooling-demand") {} - ~SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() {} + ~SubscribeAttributeThermostatPICoolingDemand() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePICoolingDemandWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute PIHeatingDemand */ -class ReadWiFiNetworkDiagnosticsClusterRevision : public ReadAttribute { +class ReadThermostatPIHeatingDemand : public ReadAttribute { public: - ReadWiFiNetworkDiagnosticsClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadThermostatPIHeatingDemand() : ReadAttribute("piheating-demand") {} + + ~ReadThermostatPIHeatingDemand() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePIHeatingDemandWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat PIHeatingDemand read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadWiFiNetworkDiagnosticsClusterRevision() {} +class SubscribeAttributeThermostatPIHeatingDemand : public SubscribeAttribute { +public: + SubscribeAttributeThermostatPIHeatingDemand() + : SubscribeAttribute("piheating-demand") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeThermostatPIHeatingDemand() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("WiFiNetworkDiagnostics ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() - : SubscribeAttribute("cluster-revision") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributePIHeatingDemandWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); + SetCommandExitStatus(error); + }]; - ~SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000036) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster EthernetNetworkDiagnostics | 0x0037 | -|------------------------------------------------------------------------------| -| Commands: | | -| * ResetCounts | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * PHYRate | 0x0000 | -| * FullDuplex | 0x0001 | -| * PacketRxCount | 0x0002 | -| * PacketTxCount | 0x0003 | -| * TxErrCount | 0x0004 | -| * CollisionCount | 0x0005 | -| * OverrunCount | 0x0006 | -| * CarrierDetect | 0x0007 | -| * TimeSinceReset | 0x0008 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ + return CHIP_NO_ERROR; + } +}; /* - * Command ResetCounts + * Attribute HVACSystemTypeConfiguration */ -class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand { +class ReadThermostatHVACSystemTypeConfiguration : public ReadAttribute { public: - EthernetNetworkDiagnosticsResetCounts() - : ClusterCommand("reset-counts") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTREthernetNetworkDiagnosticsClusterResetCountsParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster resetCountsWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: + ReadThermostatHVACSystemTypeConfiguration() + : ReadAttribute("hvacsystem-type-configuration") {} + + ~ReadThermostatHVACSystemTypeConfiguration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHVACSystemTypeConfigurationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat HVACSystemTypeConfiguration read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Attribute PHYRate - */ -class ReadEthernetNetworkDiagnosticsPHYRate : public ReadAttribute { +class WriteThermostatHVACSystemTypeConfiguration : public WriteAttribute { public: - ReadEthernetNetworkDiagnosticsPHYRate() - : ReadAttribute("phyrate") - { - } - - ~ReadEthernetNetworkDiagnosticsPHYRate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000000) on endpoint %u", endpointId); + WriteThermostatHVACSystemTypeConfiguration() + : WriteAttribute("hvacsystem-type-configuration") { + AddArgument("attr-name", "hvacsystem-type-configuration"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatHVACSystemTypeConfiguration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeHVACSystemTypeConfigurationWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "HVACSystemTypeConfigur" + "ation write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePHYRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics PHYRate read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsPHYRate : public SubscribeAttribute { +class SubscribeAttributeThermostatHVACSystemTypeConfiguration + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() - : SubscribeAttribute("phyrate") - { - } + SubscribeAttributeThermostatHVACSystemTypeConfiguration() + : SubscribeAttribute("hvacsystem-type-configuration") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() {} + ~SubscribeAttributeThermostatHVACSystemTypeConfiguration() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHVACSystemTypeConfigurationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePHYRateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FullDuplex + * Attribute LocalTemperatureCalibration */ -class ReadEthernetNetworkDiagnosticsFullDuplex : public ReadAttribute { +class ReadThermostatLocalTemperatureCalibration : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsFullDuplex() - : ReadAttribute("full-duplex") - { - } - - ~ReadEthernetNetworkDiagnosticsFullDuplex() {} + ReadThermostatLocalTemperatureCalibration() + : ReadAttribute("local-temperature-calibration") {} + + ~ReadThermostatLocalTemperatureCalibration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLocalTemperatureCalibrationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.LocalTemperatureCalibration response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat LocalTemperatureCalibration read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000001) on endpoint %u", endpointId); +class WriteThermostatLocalTemperatureCalibration : public WriteAttribute { +public: + WriteThermostatLocalTemperatureCalibration() + : WriteAttribute("local-temperature-calibration") { + AddArgument("attr-name", "local-temperature-calibration"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatLocalTemperatureCalibration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithChar:mValue]; + + [cluster + writeAttributeLocalTemperatureCalibrationWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "LocalTemperatureCalibr" + "ation write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFullDuplexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics FullDuplex read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex : public SubscribeAttribute { +class SubscribeAttributeThermostatLocalTemperatureCalibration + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() - : SubscribeAttribute("full-duplex") - { - } + SubscribeAttributeThermostatLocalTemperatureCalibration() + : SubscribeAttribute("local-temperature-calibration") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() {} + ~SubscribeAttributeThermostatLocalTemperatureCalibration() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLocalTemperatureCalibrationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFullDuplexWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.LocalTemperatureCalibration response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketRxCount + * Attribute OccupiedCoolingSetpoint */ -class ReadEthernetNetworkDiagnosticsPacketRxCount : public ReadAttribute { +class ReadThermostatOccupiedCoolingSetpoint : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsPacketRxCount() - : ReadAttribute("packet-rx-count") - { - } - - ~ReadEthernetNetworkDiagnosticsPacketRxCount() {} + ReadThermostatOccupiedCoolingSetpoint() + : ReadAttribute("occupied-cooling-setpoint") {} + + ~ReadThermostatOccupiedCoolingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupiedCoolingSetpointWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat OccupiedCoolingSetpoint read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000002) on endpoint %u", endpointId); +class WriteThermostatOccupiedCoolingSetpoint : public WriteAttribute { +public: + WriteThermostatOccupiedCoolingSetpoint() + : WriteAttribute("occupied-cooling-setpoint") { + AddArgument("attr-name", "occupied-cooling-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatOccupiedCoolingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeOccupiedCoolingSetpointWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "OccupiedCoolingSetp" + "oint write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics PacketRxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount : public SubscribeAttribute { +class SubscribeAttributeThermostatOccupiedCoolingSetpoint + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() - : SubscribeAttribute("packet-rx-count") - { - } + SubscribeAttributeThermostatOccupiedCoolingSetpoint() + : SubscribeAttribute("occupied-cooling-setpoint") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() {} + ~SubscribeAttributeThermostatOccupiedCoolingSetpoint() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupiedCoolingSetpointWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketRxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PacketTxCount + * Attribute OccupiedHeatingSetpoint */ -class ReadEthernetNetworkDiagnosticsPacketTxCount : public ReadAttribute { +class ReadThermostatOccupiedHeatingSetpoint : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsPacketTxCount() - : ReadAttribute("packet-tx-count") - { - } - - ~ReadEthernetNetworkDiagnosticsPacketTxCount() {} + ReadThermostatOccupiedHeatingSetpoint() + : ReadAttribute("occupied-heating-setpoint") {} + + ~ReadThermostatOccupiedHeatingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupiedHeatingSetpointWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat OccupiedHeatingSetpoint read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000003) on endpoint %u", endpointId); +class WriteThermostatOccupiedHeatingSetpoint : public WriteAttribute { +public: + WriteThermostatOccupiedHeatingSetpoint() + : WriteAttribute("occupied-heating-setpoint") { + AddArgument("attr-name", "occupied-heating-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatOccupiedHeatingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeOccupiedHeatingSetpointWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "OccupiedHeatingSetp" + "oint write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePacketTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics PacketTxCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount : public SubscribeAttribute { +class SubscribeAttributeThermostatOccupiedHeatingSetpoint + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() - : SubscribeAttribute("packet-tx-count") - { - } + SubscribeAttributeThermostatOccupiedHeatingSetpoint() + : SubscribeAttribute("occupied-heating-setpoint") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() {} + ~SubscribeAttributeThermostatOccupiedHeatingSetpoint() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupiedHeatingSetpointWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePacketTxCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TxErrCount + * Attribute UnoccupiedCoolingSetpoint */ -class ReadEthernetNetworkDiagnosticsTxErrCount : public ReadAttribute { +class ReadThermostatUnoccupiedCoolingSetpoint : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsTxErrCount() - : ReadAttribute("tx-err-count") - { - } - - ~ReadEthernetNetworkDiagnosticsTxErrCount() {} + ReadThermostatUnoccupiedCoolingSetpoint() + : ReadAttribute("unoccupied-cooling-setpoint") {} + + ~ReadThermostatUnoccupiedCoolingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnoccupiedCoolingSetpointWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat UnoccupiedCoolingSetpoint read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000004) on endpoint %u", endpointId); +class WriteThermostatUnoccupiedCoolingSetpoint : public WriteAttribute { +public: + WriteThermostatUnoccupiedCoolingSetpoint() + : WriteAttribute("unoccupied-cooling-setpoint") { + AddArgument("attr-name", "unoccupied-cooling-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUnoccupiedCoolingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeUnoccupiedCoolingSetpointWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "UnoccupiedCoolingSetpoin" + "t write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTxErrCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics TxErrCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount : public SubscribeAttribute { +class SubscribeAttributeThermostatUnoccupiedCoolingSetpoint + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() - : SubscribeAttribute("tx-err-count") - { - } + SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() + : SubscribeAttribute("unoccupied-cooling-setpoint") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() {} + ~SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnoccupiedCoolingSetpointWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTxErrCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CollisionCount + * Attribute UnoccupiedHeatingSetpoint */ -class ReadEthernetNetworkDiagnosticsCollisionCount : public ReadAttribute { +class ReadThermostatUnoccupiedHeatingSetpoint : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsCollisionCount() - : ReadAttribute("collision-count") - { - } - - ~ReadEthernetNetworkDiagnosticsCollisionCount() {} + ReadThermostatUnoccupiedHeatingSetpoint() + : ReadAttribute("unoccupied-heating-setpoint") {} + + ~ReadThermostatUnoccupiedHeatingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnoccupiedHeatingSetpointWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat UnoccupiedHeatingSetpoint read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000005) on endpoint %u", endpointId); +class WriteThermostatUnoccupiedHeatingSetpoint : public WriteAttribute { +public: + WriteThermostatUnoccupiedHeatingSetpoint() + : WriteAttribute("unoccupied-heating-setpoint") { + AddArgument("attr-name", "unoccupied-heating-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUnoccupiedHeatingSetpoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeUnoccupiedHeatingSetpointWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "UnoccupiedHeatingSetpoin" + "t write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCollisionCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics CollisionCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount : public SubscribeAttribute { +class SubscribeAttributeThermostatUnoccupiedHeatingSetpoint + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() - : SubscribeAttribute("collision-count") - { - } + SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() + : SubscribeAttribute("unoccupied-heating-setpoint") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() {} + ~SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnoccupiedHeatingSetpointWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCollisionCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute OverrunCount + * Attribute MinHeatSetpointLimit */ -class ReadEthernetNetworkDiagnosticsOverrunCount : public ReadAttribute { +class ReadThermostatMinHeatSetpointLimit : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsOverrunCount() - : ReadAttribute("overrun-count") - { - } - - ~ReadEthernetNetworkDiagnosticsOverrunCount() {} + ReadThermostatMinHeatSetpointLimit() + : ReadAttribute("min-heat-setpoint-limit") {} + + ~ReadThermostatMinHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinHeatSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinHeatSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat MinHeatSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000006) on endpoint %u", endpointId); +class WriteThermostatMinHeatSetpointLimit : public WriteAttribute { +public: + WriteThermostatMinHeatSetpointLimit() + : WriteAttribute("min-heat-setpoint-limit") { + AddArgument("attr-name", "min-heat-setpoint-limit"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatMinHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster writeAttributeMinHeatSetpointLimitWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "MinHeatSetpointLi" + "mit write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics OverrunCount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount : public SubscribeAttribute { +class SubscribeAttributeThermostatMinHeatSetpointLimit + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() - : SubscribeAttribute("overrun-count") - { - } + SubscribeAttributeThermostatMinHeatSetpointLimit() + : SubscribeAttribute("min-heat-setpoint-limit") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() {} + ~SubscribeAttributeThermostatMinHeatSetpointLimit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinHeatSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOverrunCountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinHeatSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CarrierDetect + * Attribute MaxHeatSetpointLimit */ -class ReadEthernetNetworkDiagnosticsCarrierDetect : public ReadAttribute { +class ReadThermostatMaxHeatSetpointLimit : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsCarrierDetect() - : ReadAttribute("carrier-detect") - { - } + ReadThermostatMaxHeatSetpointLimit() + : ReadAttribute("max-heat-setpoint-limit") {} + + ~ReadThermostatMaxHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxHeatSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat MaxHeatSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadEthernetNetworkDiagnosticsCarrierDetect() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000007) on endpoint %u", endpointId); +class WriteThermostatMaxHeatSetpointLimit : public WriteAttribute { +public: + WriteThermostatMaxHeatSetpointLimit() + : WriteAttribute("max-heat-setpoint-limit") { + AddArgument("attr-name", "max-heat-setpoint-limit"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatMaxHeatSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster writeAttributeMaxHeatSetpointLimitWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "MaxHeatSetpointLi" + "mit write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCarrierDetectWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics CarrierDetect read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect : public SubscribeAttribute { +class SubscribeAttributeThermostatMaxHeatSetpointLimit + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() - : SubscribeAttribute("carrier-detect") - { - } + SubscribeAttributeThermostatMaxHeatSetpointLimit() + : SubscribeAttribute("max-heat-setpoint-limit") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() {} + ~SubscribeAttributeThermostatMaxHeatSetpointLimit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxHeatSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCarrierDetectWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TimeSinceReset + * Attribute MinCoolSetpointLimit */ -class ReadEthernetNetworkDiagnosticsTimeSinceReset : public ReadAttribute { +class ReadThermostatMinCoolSetpointLimit : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsTimeSinceReset() - : ReadAttribute("time-since-reset") - { - } - - ~ReadEthernetNetworkDiagnosticsTimeSinceReset() {} + ReadThermostatMinCoolSetpointLimit() + : ReadAttribute("min-cool-setpoint-limit") {} + + ~ReadThermostatMinCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinCoolSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinCoolSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat MinCoolSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x00000008) on endpoint %u", endpointId); +class WriteThermostatMinCoolSetpointLimit : public WriteAttribute { +public: + WriteThermostatMinCoolSetpointLimit() + : WriteAttribute("min-cool-setpoint-limit") { + AddArgument("attr-name", "min-cool-setpoint-limit"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatMinCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster writeAttributeMinCoolSetpointLimitWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "MinCoolSetpointLi" + "mit write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTimeSinceResetWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics TimeSinceReset read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset : public SubscribeAttribute { +class SubscribeAttributeThermostatMinCoolSetpointLimit + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() - : SubscribeAttribute("time-since-reset") - { - } + SubscribeAttributeThermostatMinCoolSetpointLimit() + : SubscribeAttribute("min-cool-setpoint-limit") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() {} + ~SubscribeAttributeThermostatMinCoolSetpointLimit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinCoolSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTimeSinceResetWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinCoolSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute MaxCoolSetpointLimit */ -class ReadEthernetNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { +class ReadThermostatMaxCoolSetpointLimit : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadEthernetNetworkDiagnosticsGeneratedCommandList() {} + ReadThermostatMaxCoolSetpointLimit() + : ReadAttribute("max-cool-setpoint-limit") {} + + ~ReadThermostatMaxCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxCoolSetpointLimitWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat MaxCoolSetpointLimit read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteThermostatMaxCoolSetpointLimit : public WriteAttribute { +public: + WriteThermostatMaxCoolSetpointLimit() + : WriteAttribute("max-cool-setpoint-limit") { + AddArgument("attr-name", "max-cool-setpoint-limit"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatMaxCoolSetpointLimit() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster writeAttributeMaxCoolSetpointLimitWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "MaxCoolSetpointLi" + "mit write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int16_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeThermostatMaxCoolSetpointLimit + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeThermostatMaxCoolSetpointLimit() + : SubscribeAttribute("max-cool-setpoint-limit") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() {} + ~SubscribeAttributeThermostatMaxCoolSetpointLimit() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxCoolSetpointLimitWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute MinSetpointDeadBand */ -class ReadEthernetNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { +class ReadThermostatMinSetpointDeadBand : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadEthernetNetworkDiagnosticsAcceptedCommandList() {} + ReadThermostatMinSetpointDeadBand() + : ReadAttribute("min-setpoint-dead-band") {} + + ~ReadThermostatMinSetpointDeadBand() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinSetpointDeadBandWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat MinSetpointDeadBand read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteThermostatMinSetpointDeadBand : public WriteAttribute { +public: + WriteThermostatMinSetpointDeadBand() + : WriteAttribute("min-setpoint-dead-band") { + AddArgument("attr-name", "min-setpoint-dead-band"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatMinSetpointDeadBand() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithChar:mValue]; + + [cluster + writeAttributeMinSetpointDeadBandWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "MinSetpointDeadBand " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + int8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeThermostatMinSetpointDeadBand + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeThermostatMinSetpointDeadBand() + : SubscribeAttribute("min-setpoint-dead-band") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() {} + ~SubscribeAttributeThermostatMinSetpointDeadBand() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinSetpointDeadBandWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.MinSetpointDeadBand response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute RemoteSensing */ -class ReadEthernetNetworkDiagnosticsAttributeList : public ReadAttribute { +class ReadThermostatRemoteSensing : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadEthernetNetworkDiagnosticsAttributeList() {} + ReadThermostatRemoteSensing() : ReadAttribute("remote-sensing") {} + + ~ReadThermostatRemoteSensing() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRemoteSensingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.RemoteSensing response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat RemoteSensing read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteThermostatRemoteSensing : public WriteAttribute { +public: + WriteThermostatRemoteSensing() : WriteAttribute("remote-sensing") { + AddArgument("attr-name", "remote-sensing"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatRemoteSensing() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeRemoteSensingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat RemoteSensing " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsAttributeList : public SubscribeAttribute { +class SubscribeAttributeThermostatRemoteSensing : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeThermostatRemoteSensing() + : SubscribeAttribute("remote-sensing") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() {} + ~SubscribeAttributeThermostatRemoteSensing() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRemoteSensingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.RemoteSensing response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ControlSequenceOfOperation */ -class ReadEthernetNetworkDiagnosticsFeatureMap : public ReadAttribute { +class ReadThermostatControlSequenceOfOperation : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadEthernetNetworkDiagnosticsFeatureMap() {} + ReadThermostatControlSequenceOfOperation() + : ReadAttribute("control-sequence-of-operation") {} + + ~ReadThermostatControlSequenceOfOperation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeControlSequenceOfOperationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ControlSequenceOfOperation response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat ControlSequenceOfOperation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +class WriteThermostatControlSequenceOfOperation : public WriteAttribute { +public: + WriteThermostatControlSequenceOfOperation() + : WriteAttribute("control-sequence-of-operation") { + AddArgument("attr-name", "control-sequence-of-operation"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatControlSequenceOfOperation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeControlSequenceOfOperationWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "ControlSequenceOfOperat" + "ion write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap : public SubscribeAttribute { +class SubscribeAttributeThermostatControlSequenceOfOperation + : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeThermostatControlSequenceOfOperation() + : SubscribeAttribute("control-sequence-of-operation") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() {} + ~SubscribeAttributeThermostatControlSequenceOfOperation() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeControlSequenceOfOperationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ControlSequenceOfOperation response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute SystemMode */ -class ReadEthernetNetworkDiagnosticsClusterRevision : public ReadAttribute { +class ReadThermostatSystemMode : public ReadAttribute { public: - ReadEthernetNetworkDiagnosticsClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadEthernetNetworkDiagnosticsClusterRevision() {} + ReadThermostatSystemMode() : ReadAttribute("system-mode") {} + + ~ReadThermostatSystemMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSystemModeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Thermostat.SystemMode response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat SystemMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +class WriteThermostatSystemMode : public WriteAttribute { +public: + WriteThermostatSystemMode() : WriteAttribute("system-mode") { + AddArgument("attr-name", "system-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatSystemMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeSystemModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat SystemMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("EthernetNetworkDiagnostics ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision : public SubscribeAttribute { +class SubscribeAttributeThermostatSystemMode : public SubscribeAttribute { public: - SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeThermostatSystemMode() + : SubscribeAttribute("system-mode") {} - ~SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() {} + ~SubscribeAttributeThermostatSystemMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000037) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSystemModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SystemMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster BridgedDeviceBasic | 0x0039 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * VendorName | 0x0001 | -| * VendorID | 0x0002 | -| * ProductName | 0x0003 | -| * NodeLabel | 0x0005 | -| * HardwareVersion | 0x0007 | -| * HardwareVersionString | 0x0008 | -| * SoftwareVersion | 0x0009 | -| * SoftwareVersionString | 0x000A | -| * ManufacturingDate | 0x000B | -| * PartNumber | 0x000C | -| * ProductURL | 0x000D | -| * ProductLabel | 0x000E | -| * SerialNumber | 0x000F | -| * Reachable | 0x0011 | -| * UniqueID | 0x0012 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * StartUp | 0x0000 | -| * ShutDown | 0x0001 | -| * Leave | 0x0002 | -| * ReachableChanged | 0x0003 | -\*----------------------------------------------------------------------------*/ - /* - * Attribute VendorName + * Attribute ThermostatRunningMode */ -class ReadBridgedDeviceBasicVendorName : public ReadAttribute { +class ReadThermostatThermostatRunningMode : public ReadAttribute { public: - ReadBridgedDeviceBasicVendorName() - : ReadAttribute("vendor-name") - { - } - - ~ReadBridgedDeviceBasicVendorName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000001) on endpoint %u", endpointId); + ReadThermostatThermostatRunningMode() + : ReadAttribute("thermostat-running-mode") {} + + ~ReadThermostatThermostatRunningMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeThermostatRunningModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatRunningMode response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat ThermostatRunningMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatThermostatRunningMode + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatThermostatRunningMode() + : SubscribeAttribute("thermostat-running-mode") {} + + ~SubscribeAttributeThermostatThermostatRunningMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeThermostatRunningModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatRunningMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.VendorName response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic VendorName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute StartOfWeek + */ +class ReadThermostatStartOfWeek : public ReadAttribute { +public: + ReadThermostatStartOfWeek() : ReadAttribute("start-of-week") {} + + ~ReadThermostatStartOfWeek() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartOfWeekWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.StartOfWeek response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat StartOfWeek read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicVendorName : public SubscribeAttribute { +class SubscribeAttributeThermostatStartOfWeek : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicVendorName() - : SubscribeAttribute("vendor-name") - { - } + SubscribeAttributeThermostatStartOfWeek() + : SubscribeAttribute("start-of-week") {} - ~SubscribeAttributeBridgedDeviceBasicVendorName() {} + ~SubscribeAttributeThermostatStartOfWeek() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartOfWeekWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeVendorNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.VendorName response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.StartOfWeek response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute VendorID + * Attribute NumberOfWeeklyTransitions */ -class ReadBridgedDeviceBasicVendorID : public ReadAttribute { +class ReadThermostatNumberOfWeeklyTransitions : public ReadAttribute { public: - ReadBridgedDeviceBasicVendorID() - : ReadAttribute("vendor-id") - { - } - - ~ReadBridgedDeviceBasicVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.VendorID response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic VendorID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatNumberOfWeeklyTransitions() + : ReadAttribute("number-of-weekly-transitions") {} + + ~ReadThermostatNumberOfWeeklyTransitions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfWeeklyTransitionsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat NumberOfWeeklyTransitions read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatNumberOfWeeklyTransitions + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatNumberOfWeeklyTransitions() + : SubscribeAttribute("number-of-weekly-transitions") {} + + ~SubscribeAttributeThermostatNumberOfWeeklyTransitions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfWeeklyTransitionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicVendorID : public SubscribeAttribute { +/* + * Attribute NumberOfDailyTransitions + */ +class ReadThermostatNumberOfDailyTransitions : public ReadAttribute { public: - SubscribeAttributeBridgedDeviceBasicVendorID() - : SubscribeAttribute("vendor-id") - { - } - - ~SubscribeAttributeBridgedDeviceBasicVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVendorIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.VendorID response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThermostatNumberOfDailyTransitions() + : ReadAttribute("number-of-daily-transitions") {} + + ~ReadThermostatNumberOfDailyTransitions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfDailyTransitionsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.NumberOfDailyTransitions response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat NumberOfDailyTransitions read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatNumberOfDailyTransitions + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatNumberOfDailyTransitions() + : SubscribeAttribute("number-of-daily-transitions") {} + + ~SubscribeAttributeThermostatNumberOfDailyTransitions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfDailyTransitionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.NumberOfDailyTransitions response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductName + * Attribute TemperatureSetpointHold */ -class ReadBridgedDeviceBasicProductName : public ReadAttribute { +class ReadThermostatTemperatureSetpointHold : public ReadAttribute { public: - ReadBridgedDeviceBasicProductName() - : ReadAttribute("product-name") - { - } - - ~ReadBridgedDeviceBasicProductName() {} + ReadThermostatTemperatureSetpointHold() + : ReadAttribute("temperature-setpoint-hold") {} + + ~ReadThermostatTemperatureSetpointHold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000023) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTemperatureSetpointHoldWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.TemperatureSetpointHold response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat TemperatureSetpointHold read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000003) on endpoint %u", endpointId); +class WriteThermostatTemperatureSetpointHold : public WriteAttribute { +public: + WriteThermostatTemperatureSetpointHold() + : WriteAttribute("temperature-setpoint-hold") { + AddArgument("attr-name", "temperature-setpoint-hold"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatTemperatureSetpointHold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeTemperatureSetpointHoldWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat " + "TemperatureSetpoint" + "Hold write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductName response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic ProductName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicProductName : public SubscribeAttribute { +class SubscribeAttributeThermostatTemperatureSetpointHold + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicProductName() - : SubscribeAttribute("product-name") - { - } + SubscribeAttributeThermostatTemperatureSetpointHold() + : SubscribeAttribute("temperature-setpoint-hold") {} - ~SubscribeAttributeBridgedDeviceBasicProductName() {} + ~SubscribeAttributeThermostatTemperatureSetpointHold() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTemperatureSetpointHoldWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeProductNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductName response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.TemperatureSetpointHold response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute NodeLabel + * Attribute TemperatureSetpointHoldDuration */ -class ReadBridgedDeviceBasicNodeLabel : public ReadAttribute { +class ReadThermostatTemperatureSetpointHoldDuration : public ReadAttribute { public: - ReadBridgedDeviceBasicNodeLabel() - : ReadAttribute("node-label") - { - } - - ~ReadBridgedDeviceBasicNodeLabel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNodeLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.NodeLabel response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic NodeLabel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatTemperatureSetpointHoldDuration() + : ReadAttribute("temperature-setpoint-hold-duration") {} + + ~ReadThermostatTemperatureSetpointHoldDuration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTemperatureSetpointHoldDurationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat TemperatureSetpointHoldDuration read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteBridgedDeviceBasicNodeLabel : public WriteAttribute { +class WriteThermostatTemperatureSetpointHoldDuration : public WriteAttribute { public: - WriteBridgedDeviceBasicNodeLabel() - : WriteAttribute("node-label") - { - AddArgument("attr-name", "node-label"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBridgedDeviceBasicNodeLabel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeNodeLabelWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BridgedDeviceBasic NodeLabel write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteThermostatTemperatureSetpointHoldDuration() + : WriteAttribute("temperature-setpoint-hold-duration") { + AddArgument("attr-name", "temperature-setpoint-hold-duration"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatTemperatureSetpointHoldDuration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeTemperatureSetpointHoldDurationWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "TemperatureSetpoin" + "tHoldDuration " + "write Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + uint16_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicNodeLabel : public SubscribeAttribute { +class SubscribeAttributeThermostatTemperatureSetpointHoldDuration + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicNodeLabel() - : SubscribeAttribute("node-label") - { - } + SubscribeAttributeThermostatTemperatureSetpointHoldDuration() + : SubscribeAttribute("temperature-setpoint-hold-duration") {} - ~SubscribeAttributeBridgedDeviceBasicNodeLabel() {} + ~SubscribeAttributeThermostatTemperatureSetpointHoldDuration() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTemperatureSetpointHoldDurationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNodeLabelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.NodeLabel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute HardwareVersion + * Attribute ThermostatProgrammingOperationMode */ -class ReadBridgedDeviceBasicHardwareVersion : public ReadAttribute { +class ReadThermostatThermostatProgrammingOperationMode : public ReadAttribute { public: - ReadBridgedDeviceBasicHardwareVersion() - : ReadAttribute("hardware-version") - { - } - - ~ReadBridgedDeviceBasicHardwareVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000007) on endpoint %u", endpointId); + ReadThermostatThermostatProgrammingOperationMode() + : ReadAttribute("thermostat-programming-operation-mode") {} + + ~ReadThermostatThermostatProgrammingOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeThermostatProgrammingOperationModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat ThermostatProgrammingOperationMode read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteThermostatThermostatProgrammingOperationMode + : public WriteAttribute { +public: + WriteThermostatThermostatProgrammingOperationMode() + : WriteAttribute("thermostat-programming-operation-mode") { + AddArgument("attr-name", "thermostat-programming-operation-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatThermostatProgrammingOperationMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeThermostatProgrammingOperationModeWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat " + "ThermostatProgr" + "ammingOperation" + "Mode write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHardwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.HardwareVersion response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic HardwareVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicHardwareVersion : public SubscribeAttribute { +class SubscribeAttributeThermostatThermostatProgrammingOperationMode + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicHardwareVersion() - : SubscribeAttribute("hardware-version") - { - } + SubscribeAttributeThermostatThermostatProgrammingOperationMode() + : SubscribeAttribute("thermostat-programming-operation-mode") {} - ~SubscribeAttributeBridgedDeviceBasicHardwareVersion() {} + ~SubscribeAttributeThermostatThermostatProgrammingOperationMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeThermostatProgrammingOperationModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeHardwareVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.HardwareVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute HardwareVersionString + * Attribute ThermostatRunningState */ -class ReadBridgedDeviceBasicHardwareVersionString : public ReadAttribute { +class ReadThermostatThermostatRunningState : public ReadAttribute { public: - ReadBridgedDeviceBasicHardwareVersionString() - : ReadAttribute("hardware-version-string") - { - } - - ~ReadBridgedDeviceBasicHardwareVersionString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHardwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.HardwareVersionString response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic HardwareVersionString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatThermostatRunningState() + : ReadAttribute("thermostat-running-state") {} + + ~ReadThermostatThermostatRunningState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeThermostatRunningStateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatRunningState response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat ThermostatRunningState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatThermostatRunningState + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatThermostatRunningState() + : SubscribeAttribute("thermostat-running-state") {} + + ~SubscribeAttributeThermostatThermostatRunningState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeThermostatRunningStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ThermostatRunningState response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicHardwareVersionString : public SubscribeAttribute { +/* + * Attribute SetpointChangeSource + */ +class ReadThermostatSetpointChangeSource : public ReadAttribute { public: - SubscribeAttributeBridgedDeviceBasicHardwareVersionString() - : SubscribeAttribute("hardware-version-string") - { - } - - ~SubscribeAttributeBridgedDeviceBasicHardwareVersionString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeHardwareVersionStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.HardwareVersionString response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThermostatSetpointChangeSource() + : ReadAttribute("setpoint-change-source") {} + + ~ReadThermostatSetpointChangeSource() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSetpointChangeSourceWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeSource response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat SetpointChangeSource read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatSetpointChangeSource + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatSetpointChangeSource() + : SubscribeAttribute("setpoint-change-source") {} + + ~SubscribeAttributeThermostatSetpointChangeSource() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSetpointChangeSourceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeSource response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SoftwareVersion + * Attribute SetpointChangeAmount */ -class ReadBridgedDeviceBasicSoftwareVersion : public ReadAttribute { +class ReadThermostatSetpointChangeAmount : public ReadAttribute { public: - ReadBridgedDeviceBasicSoftwareVersion() - : ReadAttribute("software-version") - { - } - - ~ReadBridgedDeviceBasicSoftwareVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSoftwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SoftwareVersion response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic SoftwareVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatSetpointChangeAmount() + : ReadAttribute("setpoint-change-amount") {} + + ~ReadThermostatSetpointChangeAmount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSetpointChangeAmountWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeAmount response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat SetpointChangeAmount read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatSetpointChangeAmount + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatSetpointChangeAmount() + : SubscribeAttribute("setpoint-change-amount") {} + + ~SubscribeAttributeThermostatSetpointChangeAmount() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSetpointChangeAmountWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeAmount response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicSoftwareVersion : public SubscribeAttribute { +/* + * Attribute SetpointChangeSourceTimestamp + */ +class ReadThermostatSetpointChangeSourceTimestamp : public ReadAttribute { public: - SubscribeAttributeBridgedDeviceBasicSoftwareVersion() - : SubscribeAttribute("software-version") - { - } - - ~SubscribeAttributeBridgedDeviceBasicSoftwareVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSoftwareVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SoftwareVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThermostatSetpointChangeSourceTimestamp() + : ReadAttribute("setpoint-change-source-timestamp") {} + + ~ReadThermostatSetpointChangeSourceTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSetpointChangeSourceTimestampWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat SetpointChangeSourceTimestamp read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatSetpointChangeSourceTimestamp + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatSetpointChangeSourceTimestamp() + : SubscribeAttribute("setpoint-change-source-timestamp") {} + + ~SubscribeAttributeThermostatSetpointChangeSourceTimestamp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSetpointChangeSourceTimestampWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SoftwareVersionString + * Attribute OccupiedSetback */ -class ReadBridgedDeviceBasicSoftwareVersionString : public ReadAttribute { +class ReadThermostatOccupiedSetback : public ReadAttribute { public: - ReadBridgedDeviceBasicSoftwareVersionString() - : ReadAttribute("software-version-string") - { - } - - ~ReadBridgedDeviceBasicSoftwareVersionString() {} + ReadThermostatOccupiedSetback() : ReadAttribute("occupied-setback") {} + + ~ReadThermostatOccupiedSetback() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000034) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupiedSetbackWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat OccupiedSetback read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000A) on endpoint %u", endpointId); +class WriteThermostatOccupiedSetback : public WriteAttribute { +public: + WriteThermostatOccupiedSetback() : WriteAttribute("occupied-setback") { + AddArgument("attr-name", "occupied-setback"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatOccupiedSetback() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOccupiedSetbackWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat OccupiedSetback " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSoftwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SoftwareVersionString response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic SoftwareVersionString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicSoftwareVersionString : public SubscribeAttribute { +class SubscribeAttributeThermostatOccupiedSetback : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicSoftwareVersionString() - : SubscribeAttribute("software-version-string") - { - } + SubscribeAttributeThermostatOccupiedSetback() + : SubscribeAttribute("occupied-setback") {} - ~SubscribeAttributeBridgedDeviceBasicSoftwareVersionString() {} + ~SubscribeAttributeThermostatOccupiedSetback() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupiedSetbackWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSoftwareVersionStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SoftwareVersionString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ManufacturingDate + * Attribute OccupiedSetbackMin */ -class ReadBridgedDeviceBasicManufacturingDate : public ReadAttribute { +class ReadThermostatOccupiedSetbackMin : public ReadAttribute { public: - ReadBridgedDeviceBasicManufacturingDate() - : ReadAttribute("manufacturing-date") - { - } - - ~ReadBridgedDeviceBasicManufacturingDate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeManufacturingDateWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ManufacturingDate response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic ManufacturingDate read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatOccupiedSetbackMin() : ReadAttribute("occupied-setback-min") {} + + ~ReadThermostatOccupiedSetbackMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000035) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupiedSetbackMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetbackMin response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat OccupiedSetbackMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatOccupiedSetbackMin + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatOccupiedSetbackMin() + : SubscribeAttribute("occupied-setback-min") {} + + ~SubscribeAttributeThermostatOccupiedSetbackMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupiedSetbackMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetbackMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicManufacturingDate : public SubscribeAttribute { +/* + * Attribute OccupiedSetbackMax + */ +class ReadThermostatOccupiedSetbackMax : public ReadAttribute { public: - SubscribeAttributeBridgedDeviceBasicManufacturingDate() - : SubscribeAttribute("manufacturing-date") - { - } - - ~SubscribeAttributeBridgedDeviceBasicManufacturingDate() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeManufacturingDateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ManufacturingDate response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadThermostatOccupiedSetbackMax() : ReadAttribute("occupied-setback-max") {} + + ~ReadThermostatOccupiedSetbackMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000036) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupiedSetbackMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetbackMax response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat OccupiedSetbackMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatOccupiedSetbackMax + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatOccupiedSetbackMax() + : SubscribeAttribute("occupied-setback-max") {} + + ~SubscribeAttributeThermostatOccupiedSetbackMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000036) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupiedSetbackMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.OccupiedSetbackMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PartNumber + * Attribute UnoccupiedSetback */ -class ReadBridgedDeviceBasicPartNumber : public ReadAttribute { +class ReadThermostatUnoccupiedSetback : public ReadAttribute { public: - ReadBridgedDeviceBasicPartNumber() - : ReadAttribute("part-number") - { - } - - ~ReadBridgedDeviceBasicPartNumber() {} + ReadThermostatUnoccupiedSetback() : ReadAttribute("unoccupied-setback") {} + + ~ReadThermostatUnoccupiedSetback() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000037) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnoccupiedSetbackWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetback response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat UnoccupiedSetback read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000C) on endpoint %u", endpointId); +class WriteThermostatUnoccupiedSetback : public WriteAttribute { +public: + WriteThermostatUnoccupiedSetback() : WriteAttribute("unoccupied-setback") { + AddArgument("attr-name", "unoccupied-setback"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUnoccupiedSetback() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000037) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeUnoccupiedSetbackWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat UnoccupiedSetback " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePartNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.PartNumber response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic PartNumber read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicPartNumber : public SubscribeAttribute { +class SubscribeAttributeThermostatUnoccupiedSetback + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicPartNumber() - : SubscribeAttribute("part-number") - { - } + SubscribeAttributeThermostatUnoccupiedSetback() + : SubscribeAttribute("unoccupied-setback") {} - ~SubscribeAttributeBridgedDeviceBasicPartNumber() {} + ~SubscribeAttributeThermostatUnoccupiedSetback() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000037) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnoccupiedSetbackWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePartNumberWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.PartNumber response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetback response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductURL + * Attribute UnoccupiedSetbackMin */ -class ReadBridgedDeviceBasicProductURL : public ReadAttribute { +class ReadThermostatUnoccupiedSetbackMin : public ReadAttribute { public: - ReadBridgedDeviceBasicProductURL() - : ReadAttribute("product-url") - { - } - - ~ReadBridgedDeviceBasicProductURL() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductURL response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic ProductURL read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadThermostatUnoccupiedSetbackMin() + : ReadAttribute("unoccupied-setback-min") {} + + ~ReadThermostatUnoccupiedSetbackMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000038) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnoccupiedSetbackMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat UnoccupiedSetbackMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUnoccupiedSetbackMin + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUnoccupiedSetbackMin() + : SubscribeAttribute("unoccupied-setback-min") {} + + ~SubscribeAttributeThermostatUnoccupiedSetbackMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000038) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnoccupiedSetbackMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicProductURL : public SubscribeAttribute { -public: - SubscribeAttributeBridgedDeviceBasicProductURL() - : SubscribeAttribute("product-url") - { - } - - ~SubscribeAttributeBridgedDeviceBasicProductURL() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeProductURLWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductURL response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute UnoccupiedSetbackMax + */ +class ReadThermostatUnoccupiedSetbackMax : public ReadAttribute { +public: + ReadThermostatUnoccupiedSetbackMax() + : ReadAttribute("unoccupied-setback-max") {} + + ~ReadThermostatUnoccupiedSetbackMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000039) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnoccupiedSetbackMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat UnoccupiedSetbackMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUnoccupiedSetbackMax + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUnoccupiedSetbackMax() + : SubscribeAttribute("unoccupied-setback-max") {} + + ~SubscribeAttributeThermostatUnoccupiedSetbackMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000039) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnoccupiedSetbackMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ProductLabel + * Attribute EmergencyHeatDelta */ -class ReadBridgedDeviceBasicProductLabel : public ReadAttribute { +class ReadThermostatEmergencyHeatDelta : public ReadAttribute { public: - ReadBridgedDeviceBasicProductLabel() - : ReadAttribute("product-label") - { - } - - ~ReadBridgedDeviceBasicProductLabel() {} + ReadThermostatEmergencyHeatDelta() : ReadAttribute("emergency-heat-delta") {} + + ~ReadThermostatEmergencyHeatDelta() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEmergencyHeatDeltaWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.EmergencyHeatDelta response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat EmergencyHeatDelta read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000E) on endpoint %u", endpointId); +class WriteThermostatEmergencyHeatDelta : public WriteAttribute { +public: + WriteThermostatEmergencyHeatDelta() : WriteAttribute("emergency-heat-delta") { + AddArgument("attr-name", "emergency-heat-delta"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatEmergencyHeatDelta() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeEmergencyHeatDeltaWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat EmergencyHeatDelta " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductLabel response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic ProductLabel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicProductLabel : public SubscribeAttribute { +class SubscribeAttributeThermostatEmergencyHeatDelta + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicProductLabel() - : SubscribeAttribute("product-label") - { - } + SubscribeAttributeThermostatEmergencyHeatDelta() + : SubscribeAttribute("emergency-heat-delta") {} - ~SubscribeAttributeBridgedDeviceBasicProductLabel() {} + ~SubscribeAttributeThermostatEmergencyHeatDelta() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEmergencyHeatDeltaWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeProductLabelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ProductLabel response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.EmergencyHeatDelta response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute SerialNumber + * Attribute ACType */ -class ReadBridgedDeviceBasicSerialNumber : public ReadAttribute { +class ReadThermostatACType : public ReadAttribute { public: - ReadBridgedDeviceBasicSerialNumber() - : ReadAttribute("serial-number") - { - } - - ~ReadBridgedDeviceBasicSerialNumber() {} + ReadThermostatACType() : ReadAttribute("actype") {} + + ~ReadThermostatACType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000040) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACTypeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Thermostat.ACType response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000000F) on endpoint %u", endpointId); +class WriteThermostatACType : public WriteAttribute { +public: + WriteThermostatACType() : WriteAttribute("actype") { + AddArgument("attr-name", "actype"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000040) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeACTypeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("Thermostat ACType write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSerialNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SerialNumber response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic SerialNumber read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicSerialNumber : public SubscribeAttribute { +class SubscribeAttributeThermostatACType : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicSerialNumber() - : SubscribeAttribute("serial-number") - { - } + SubscribeAttributeThermostatACType() : SubscribeAttribute("actype") {} - ~SubscribeAttributeBridgedDeviceBasicSerialNumber() {} + ~SubscribeAttributeThermostatACType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000040) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSerialNumberWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.SerialNumber response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACType response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Reachable + * Attribute ACCapacity */ -class ReadBridgedDeviceBasicReachable : public ReadAttribute { +class ReadThermostatACCapacity : public ReadAttribute { public: - ReadBridgedDeviceBasicReachable() - : ReadAttribute("reachable") - { - } - - ~ReadBridgedDeviceBasicReachable() {} + ReadThermostatACCapacity() : ReadAttribute("accapacity") {} + + ~ReadThermostatACCapacity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000041) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACCapacityWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Thermostat.ACCapacity response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACCapacity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000011) on endpoint %u", endpointId); +class WriteThermostatACCapacity : public WriteAttribute { +public: + WriteThermostatACCapacity() : WriteAttribute("accapacity") { + AddArgument("attr-name", "accapacity"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACCapacity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000041) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeACCapacityWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACCapacity write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReachableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.Reachable response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic Reachable read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicReachable : public SubscribeAttribute { +class SubscribeAttributeThermostatACCapacity : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicReachable() - : SubscribeAttribute("reachable") - { - } + SubscribeAttributeThermostatACCapacity() : SubscribeAttribute("accapacity") {} - ~SubscribeAttributeBridgedDeviceBasicReachable() {} + ~SubscribeAttributeThermostatACCapacity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000041) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACCapacityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeReachableWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.Reachable response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCapacity response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute UniqueID + * Attribute ACRefrigerantType */ -class ReadBridgedDeviceBasicUniqueID : public ReadAttribute { +class ReadThermostatACRefrigerantType : public ReadAttribute { public: - ReadBridgedDeviceBasicUniqueID() - : ReadAttribute("unique-id") - { - } - - ~ReadBridgedDeviceBasicUniqueID() {} + ReadThermostatACRefrigerantType() : ReadAttribute("acrefrigerant-type") {} + + ~ReadThermostatACRefrigerantType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000042) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACRefrigerantTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACRefrigerantType response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACRefrigerantType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x00000012) on endpoint %u", endpointId); +class WriteThermostatACRefrigerantType : public WriteAttribute { +public: + WriteThermostatACRefrigerantType() : WriteAttribute("acrefrigerant-type") { + AddArgument("attr-name", "acrefrigerant-type"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACRefrigerantType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000042) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeACRefrigerantTypeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACRefrigerantType " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUniqueIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.UniqueID response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic UniqueID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicUniqueID : public SubscribeAttribute { +class SubscribeAttributeThermostatACRefrigerantType + : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicUniqueID() - : SubscribeAttribute("unique-id") - { - } + SubscribeAttributeThermostatACRefrigerantType() + : SubscribeAttribute("acrefrigerant-type") {} - ~SubscribeAttributeBridgedDeviceBasicUniqueID() {} + ~SubscribeAttributeThermostatACRefrigerantType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000042) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACRefrigerantTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeUniqueIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.UniqueID response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACRefrigerantType response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ACCompressorType */ -class ReadBridgedDeviceBasicGeneratedCommandList : public ReadAttribute { +class ReadThermostatACCompressorType : public ReadAttribute { public: - ReadBridgedDeviceBasicGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBridgedDeviceBasicGeneratedCommandList() {} + ReadThermostatACCompressorType() : ReadAttribute("accompressor-type") {} + + ~ReadThermostatACCompressorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000043) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACCompressorTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCompressorType response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACCompressorType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteThermostatACCompressorType : public WriteAttribute { +public: + WriteThermostatACCompressorType() : WriteAttribute("accompressor-type") { + AddArgument("attr-name", "accompressor-type"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACCompressorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000043) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeACCompressorTypeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACCompressorType " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeThermostatACCompressorType : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeThermostatACCompressorType() + : SubscribeAttribute("accompressor-type") {} - ~SubscribeAttributeBridgedDeviceBasicGeneratedCommandList() {} + ~SubscribeAttributeThermostatACCompressorType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000043) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACCompressorTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCompressorType response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute ACErrorCode */ -class ReadBridgedDeviceBasicAcceptedCommandList : public ReadAttribute { +class ReadThermostatACErrorCode : public ReadAttribute { public: - ReadBridgedDeviceBasicAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBridgedDeviceBasicAcceptedCommandList() {} + ReadThermostatACErrorCode() : ReadAttribute("acerror-code") {} + + ~ReadThermostatACErrorCode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000044) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACErrorCodeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACErrorCode response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACErrorCode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteThermostatACErrorCode : public WriteAttribute { +public: + WriteThermostatACErrorCode() : WriteAttribute("acerror-code") { + AddArgument("attr-name", "acerror-code"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACErrorCode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000044) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeACErrorCodeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACErrorCode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeThermostatACErrorCode : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeThermostatACErrorCode() + : SubscribeAttribute("acerror-code") {} - ~SubscribeAttributeBridgedDeviceBasicAcceptedCommandList() {} + ~SubscribeAttributeThermostatACErrorCode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000044) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACErrorCodeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACErrorCode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute ACLouverPosition */ -class ReadBridgedDeviceBasicAttributeList : public ReadAttribute { +class ReadThermostatACLouverPosition : public ReadAttribute { public: - ReadBridgedDeviceBasicAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadBridgedDeviceBasicAttributeList() {} + ReadThermostatACLouverPosition() : ReadAttribute("aclouver-position") {} + + ~ReadThermostatACLouverPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000045) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACLouverPositionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACLouverPosition response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACLouverPosition read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteThermostatACLouverPosition : public WriteAttribute { +public: + WriteThermostatACLouverPosition() : WriteAttribute("aclouver-position") { + AddArgument("attr-name", "aclouver-position"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACLouverPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000045) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeACLouverPositionWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACLouverPosition " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicAttributeList : public SubscribeAttribute { +class SubscribeAttributeThermostatACLouverPosition : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeThermostatACLouverPosition() + : SubscribeAttribute("aclouver-position") {} - ~SubscribeAttributeBridgedDeviceBasicAttributeList() {} + ~SubscribeAttributeThermostatACLouverPosition() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000045) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACLouverPositionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACLouverPosition response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ACCoilTemperature */ -class ReadBridgedDeviceBasicFeatureMap : public ReadAttribute { +class ReadThermostatACCoilTemperature : public ReadAttribute { public: - ReadBridgedDeviceBasicFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadThermostatACCoilTemperature() : ReadAttribute("accoil-temperature") {} + + ~ReadThermostatACCoilTemperature() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000046) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACCoilTemperatureWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCoilTemperature response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACCoilTemperature read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatACCoilTemperature + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatACCoilTemperature() + : SubscribeAttribute("accoil-temperature") {} + + ~SubscribeAttributeThermostatACCoilTemperature() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000046) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACCoilTemperatureWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCoilTemperature response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadBridgedDeviceBasicFeatureMap() {} +/* + * Attribute ACCapacityformat + */ +class ReadThermostatACCapacityformat : public ReadAttribute { +public: + ReadThermostatACCapacityformat() : ReadAttribute("accapacityformat") {} + + ~ReadThermostatACCapacityformat() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x00000047) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeACCapacityformatWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ACCapacityformat read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +class WriteThermostatACCapacityformat : public WriteAttribute { +public: + WriteThermostatACCapacityformat() : WriteAttribute("accapacityformat") { + AddArgument("attr-name", "accapacityformat"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatACCapacityformat() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) WriteAttribute (0x00000047) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeACCapacityformatWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "Thermostat ACCapacityformat " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBridgedDeviceBasicFeatureMap : public SubscribeAttribute { +class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeThermostatACCapacityformat() + : SubscribeAttribute("accapacityformat") {} - ~SubscribeAttributeBridgedDeviceBasicFeatureMap() {} + ~SubscribeAttributeThermostatACCapacityformat() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x00000047) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeACCapacityformatWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ACCapacityformat response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute GeneratedCommandList */ -class ReadBridgedDeviceBasicClusterRevision : public ReadAttribute { +class ReadThermostatGeneratedCommandList : public ReadAttribute { public: - ReadBridgedDeviceBasicClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadBridgedDeviceBasicClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ReadThermostatGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadThermostatGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("Thermostat GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeThermostatGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BridgedDeviceBasic ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadThermostatAcceptedCommandList : public ReadAttribute { +public: + ReadThermostatAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadThermostatAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeThermostatAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AttributeList + */ +class ReadThermostatAttributeList : public ReadAttribute { +public: + ReadThermostatAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadThermostatAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeBridgedDeviceBasicClusterRevision : public SubscribeAttribute { +class SubscribeAttributeThermostatAttributeList : public SubscribeAttribute { public: - SubscribeAttributeBridgedDeviceBasicClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeThermostatAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeBridgedDeviceBasicClusterRevision() {} + ~SubscribeAttributeThermostatAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000039) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute FeatureMap + */ +class ReadThermostatFeatureMap : public ReadAttribute { +public: + ReadThermostatFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadThermostatFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Thermostat.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeThermostatFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeThermostatFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BridgedDeviceBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadThermostatClusterRevision : public ReadAttribute { +public: + ReadThermostatClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadThermostatClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Thermostat ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeThermostatClusterRevision() + : SubscribeAttribute("cluster-revision") {} - return CHIP_NO_ERROR; + ~SubscribeAttributeThermostatClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000201) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostat alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Thermostat.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster Switch | 0x003B | +| Cluster FanControl | 0x0202 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | -| * NumberOfPositions | 0x0000 | -| * CurrentPosition | 0x0001 | -| * MultiPressMax | 0x0002 | +| * FanMode | 0x0000 | +| * FanModeSequence | 0x0001 | +| * PercentSetting | 0x0002 | +| * PercentCurrent | 0x0003 | +| * SpeedMax | 0x0004 | +| * SpeedSetting | 0x0005 | +| * SpeedCurrent | 0x0006 | +| * RockSupport | 0x0007 | +| * RockSetting | 0x0008 | +| * WindSupport | 0x0009 | +| * WindSetting | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -32025,1287 +62747,1581 @@ class SubscribeAttributeBridgedDeviceBasicClusterRevision : public SubscribeAttr | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * SwitchLatched | 0x0000 | -| * InitialPress | 0x0001 | -| * LongPress | 0x0002 | -| * ShortRelease | 0x0003 | -| * LongRelease | 0x0004 | -| * MultiPressOngoing | 0x0005 | -| * MultiPressComplete | 0x0006 | \*----------------------------------------------------------------------------*/ /* - * Attribute NumberOfPositions + * Attribute FanMode */ -class ReadSwitchNumberOfPositions : public ReadAttribute { +class ReadFanControlFanMode : public ReadAttribute { public: - ReadSwitchNumberOfPositions() - : ReadAttribute("number-of-positions") - { - } - - ~ReadSwitchNumberOfPositions() {} + ReadFanControlFanMode() : ReadAttribute("fan-mode") {} + + ~ReadFanControlFanMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFanModeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FanControl.FanMode response %@", [value description]); + if (error != nil) { + LogNSError("FanControl FanMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x00000000) on endpoint %u", endpointId); +class WriteFanControlFanMode : public WriteAttribute { +public: + WriteFanControlFanMode() : WriteAttribute("fan-mode") { + AddArgument("attr-name", "fan-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlFanMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeFanModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("FanControl FanMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfPositionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.NumberOfPositions response %@", [value description]); - if (error != nil) { - LogNSError("Switch NumberOfPositions read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSwitchNumberOfPositions : public SubscribeAttribute { +class SubscribeAttributeFanControlFanMode : public SubscribeAttribute { public: - SubscribeAttributeSwitchNumberOfPositions() - : SubscribeAttribute("number-of-positions") - { - } + SubscribeAttributeFanControlFanMode() : SubscribeAttribute("fan-mode") {} - ~SubscribeAttributeSwitchNumberOfPositions() {} + ~SubscribeAttributeFanControlFanMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFanModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNumberOfPositionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.NumberOfPositions response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.FanMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentPosition + * Attribute FanModeSequence */ -class ReadSwitchCurrentPosition : public ReadAttribute { +class ReadFanControlFanModeSequence : public ReadAttribute { public: - ReadSwitchCurrentPosition() - : ReadAttribute("current-position") - { - } - - ~ReadSwitchCurrentPosition() {} + ReadFanControlFanModeSequence() : ReadAttribute("fan-mode-sequence") {} + + ~ReadFanControlFanModeSequence() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFanModeSequenceWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.FanModeSequence response %@", [value description]); + if (error != nil) { + LogNSError("FanControl FanModeSequence read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x00000001) on endpoint %u", endpointId); +class WriteFanControlFanModeSequence : public WriteAttribute { +public: + WriteFanControlFanModeSequence() : WriteAttribute("fan-mode-sequence") { + AddArgument("attr-name", "fan-mode-sequence"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlFanModeSequence() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeFanModeSequenceWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("FanControl FanModeSequence " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeCurrentPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.CurrentPosition response %@", [value description]); - if (error != nil) { - LogNSError("Switch CurrentPosition read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSwitchCurrentPosition : public SubscribeAttribute { +class SubscribeAttributeFanControlFanModeSequence : public SubscribeAttribute { public: - SubscribeAttributeSwitchCurrentPosition() - : SubscribeAttribute("current-position") - { - } + SubscribeAttributeFanControlFanModeSequence() + : SubscribeAttribute("fan-mode-sequence") {} - ~SubscribeAttributeSwitchCurrentPosition() {} + ~SubscribeAttributeFanControlFanModeSequence() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFanModeSequenceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentPositionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.CurrentPosition response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.FanModeSequence response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MultiPressMax + * Attribute PercentSetting */ -class ReadSwitchMultiPressMax : public ReadAttribute { +class ReadFanControlPercentSetting : public ReadAttribute { public: - ReadSwitchMultiPressMax() - : ReadAttribute("multi-press-max") - { - } - - ~ReadSwitchMultiPressMax() {} + ReadFanControlPercentSetting() : ReadAttribute("percent-setting") {} + + ~ReadFanControlPercentSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePercentSettingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.PercentSetting response %@", [value description]); + if (error != nil) { + LogNSError("FanControl PercentSetting read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x00000002) on endpoint %u", endpointId); +class WriteFanControlPercentSetting : public WriteAttribute { +public: + WriteFanControlPercentSetting() : WriteAttribute("percent-setting") { + AddArgument("attr-name", "percent-setting"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlPercentSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributePercentSettingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("FanControl PercentSetting " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeMultiPressMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.MultiPressMax response %@", [value description]); - if (error != nil) { - LogNSError("Switch MultiPressMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSwitchMultiPressMax : public SubscribeAttribute { +class SubscribeAttributeFanControlPercentSetting : public SubscribeAttribute { public: - SubscribeAttributeSwitchMultiPressMax() - : SubscribeAttribute("multi-press-max") - { - } + SubscribeAttributeFanControlPercentSetting() + : SubscribeAttribute("percent-setting") {} - ~SubscribeAttributeSwitchMultiPressMax() {} + ~SubscribeAttributeFanControlPercentSetting() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePercentSettingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMultiPressMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.MultiPressMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.PercentSetting response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute PercentCurrent */ -class ReadSwitchGeneratedCommandList : public ReadAttribute { +class ReadFanControlPercentCurrent : public ReadAttribute { public: - ReadSwitchGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadSwitchGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Switch GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlPercentCurrent() : ReadAttribute("percent-current") {} + + ~ReadFanControlPercentCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePercentCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.PercentCurrent response %@", [value description]); + if (error != nil) { + LogNSError("FanControl PercentCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSwitchGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeFanControlPercentCurrent : public SubscribeAttribute { public: - SubscribeAttributeSwitchGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeFanControlPercentCurrent() + : SubscribeAttribute("percent-current") {} - ~SubscribeAttributeSwitchGeneratedCommandList() {} + ~SubscribeAttributeFanControlPercentCurrent() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePercentCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.PercentCurrent response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute SpeedMax */ -class ReadSwitchAcceptedCommandList : public ReadAttribute { +class ReadFanControlSpeedMax : public ReadAttribute { public: - ReadSwitchAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadSwitchAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Switch AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlSpeedMax() : ReadAttribute("speed-max") {} + + ~ReadFanControlSpeedMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FanControl.SpeedMax response %@", [value description]); + if (error != nil) { + LogNSError("FanControl SpeedMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSwitchAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeFanControlSpeedMax : public SubscribeAttribute { public: - SubscribeAttributeSwitchAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeFanControlSpeedMax() : SubscribeAttribute("speed-max") {} - ~SubscribeAttributeSwitchAcceptedCommandList() {} + ~SubscribeAttributeFanControlSpeedMax() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSpeedMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.SpeedMax response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute SpeedSetting */ -class ReadSwitchAttributeList : public ReadAttribute { +class ReadFanControlSpeedSetting : public ReadAttribute { public: - ReadSwitchAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadSwitchAttributeList() {} + ReadFanControlSpeedSetting() : ReadAttribute("speed-setting") {} + + ~ReadFanControlSpeedSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSpeedSettingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.SpeedSetting response %@", [value description]); + if (error != nil) { + LogNSError("FanControl SpeedSetting read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteFanControlSpeedSetting : public WriteAttribute { +public: + WriteFanControlSpeedSetting() : WriteAttribute("speed-setting") { + AddArgument("attr-name", "speed-setting"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlSpeedSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeSpeedSettingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "FanControl SpeedSetting write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Switch AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeSwitchAttributeList : public SubscribeAttribute { +class SubscribeAttributeFanControlSpeedSetting : public SubscribeAttribute { public: - SubscribeAttributeSwitchAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeFanControlSpeedSetting() + : SubscribeAttribute("speed-setting") {} - ~SubscribeAttributeSwitchAttributeList() {} + ~SubscribeAttributeFanControlSpeedSetting() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSpeedSettingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.SpeedSetting response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute SpeedCurrent */ -class ReadSwitchFeatureMap : public ReadAttribute { +class ReadFanControlSpeedCurrent : public ReadAttribute { public: - ReadSwitchFeatureMap() - : ReadAttribute("feature-map") - { - } + ReadFanControlSpeedCurrent() : ReadAttribute("speed-current") {} + + ~ReadFanControlSpeedCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSpeedCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.SpeedCurrent response %@", [value description]); + if (error != nil) { + LogNSError("FanControl SpeedCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadSwitchFeatureMap() {} +class SubscribeAttributeFanControlSpeedCurrent : public SubscribeAttribute { +public: + SubscribeAttributeFanControlSpeedCurrent() + : SubscribeAttribute("speed-current") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + ~SubscribeAttributeFanControlSpeedCurrent() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Switch FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeSwitchFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeSwitchFeatureMap() - : SubscribeAttribute("feature-map") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeSwitchFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSpeedCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.SpeedCurrent response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute RockSupport */ -class ReadSwitchClusterRevision : public ReadAttribute { +class ReadFanControlRockSupport : public ReadAttribute { public: - ReadSwitchClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadSwitchClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Switch ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlRockSupport() : ReadAttribute("rock-support") {} + + ~ReadFanControlRockSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRockSupportWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.RockSupport response %@", [value description]); + if (error != nil) { + LogNSError("FanControl RockSupport read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeSwitchClusterRevision : public SubscribeAttribute { +class SubscribeAttributeFanControlRockSupport : public SubscribeAttribute { public: - SubscribeAttributeSwitchClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeSwitchClusterRevision() {} + SubscribeAttributeFanControlRockSupport() + : SubscribeAttribute("rock-support") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003B) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Switch.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeFanControlRockSupport() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster AdministratorCommissioning | 0x003C | -|------------------------------------------------------------------------------| -| Commands: | | -| * OpenCommissioningWindow | 0x00 | -| * OpenBasicCommissioningWindow | 0x01 | -| * RevokeCommissioning | 0x02 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * WindowStatus | 0x0000 | -| * AdminFabricIndex | 0x0001 | -| * AdminVendorId | 0x0002 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command OpenCommissioningWindow - */ -class AdministratorCommissioningOpenCommissioningWindow : public ClusterCommand { -public: - AdministratorCommissioningOpenCommissioningWindow() - : ClusterCommand("open-commissioning-window") - { - AddArgument("CommissioningTimeout", 0, UINT16_MAX, &mRequest.commissioningTimeout); - AddArgument("PAKEVerifier", &mRequest.PAKEVerifier); - AddArgument("Discriminator", 0, UINT16_MAX, &mRequest.discriminator); - AddArgument("Iterations", 0, UINT32_MAX, &mRequest.iterations); - AddArgument("Salt", &mRequest.salt); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAdministratorCommissioningClusterOpenCommissioningWindowParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.commissioningTimeout = [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; - params.pakeVerifier = [NSData dataWithBytes:mRequest.PAKEVerifier.data() length:mRequest.PAKEVerifier.size()]; - params.discriminator = [NSNumber numberWithUnsignedShort:mRequest.discriminator]; - params.iterations = [NSNumber numberWithUnsignedInt:mRequest.iterations]; - params.salt = [NSData dataWithBytes:mRequest.salt.data() length:mRequest.salt.size()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster openCommissioningWindowWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRockSupportWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.RockSupport response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command OpenBasicCommissioningWindow + * Attribute RockSetting */ -class AdministratorCommissioningOpenBasicCommissioningWindow : public ClusterCommand { -public: - AdministratorCommissioningOpenBasicCommissioningWindow() - : ClusterCommand("open-basic-commissioning-window") - { - AddArgument("CommissioningTimeout", 0, UINT16_MAX, &mRequest.commissioningTimeout); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.commissioningTimeout = [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster openBasicCommissioningWindowWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type mRequest; +class ReadFanControlRockSetting : public ReadAttribute { +public: + ReadFanControlRockSetting() : ReadAttribute("rock-setting") {} + + ~ReadFanControlRockSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRockSettingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.RockSetting response %@", [value description]); + if (error != nil) { + LogNSError("FanControl RockSetting read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command RevokeCommissioning - */ -class AdministratorCommissioningRevokeCommissioning : public ClusterCommand { +class WriteFanControlRockSetting : public WriteAttribute { public: - AdministratorCommissioningRevokeCommissioning() - : ClusterCommand("revoke-commissioning") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAdministratorCommissioningClusterRevokeCommissioningParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster revokeCommissioningWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + WriteFanControlRockSetting() : WriteAttribute("rock-setting") { + AddArgument("attr-name", "rock-setting"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlRockSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeRockSettingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "FanControl RockSetting write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: + uint8_t mValue; }; -/* - * Attribute WindowStatus - */ -class ReadAdministratorCommissioningWindowStatus : public ReadAttribute { +class SubscribeAttributeFanControlRockSetting : public SubscribeAttribute { public: - ReadAdministratorCommissioningWindowStatus() - : ReadAttribute("window-status") - { - } + SubscribeAttributeFanControlRockSetting() + : SubscribeAttribute("rock-setting") {} - ~ReadAdministratorCommissioningWindowStatus() {} + ~SubscribeAttributeFanControlRockSetting() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWindowStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.WindowStatus response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning WindowStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeAdministratorCommissioningWindowStatus : public SubscribeAttribute { -public: - SubscribeAttributeAdministratorCommissioningWindowStatus() - : SubscribeAttribute("window-status") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeAdministratorCommissioningWindowStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRockSettingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeWindowStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.WindowStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.RockSetting response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AdminFabricIndex + * Attribute WindSupport */ -class ReadAdministratorCommissioningAdminFabricIndex : public ReadAttribute { +class ReadFanControlWindSupport : public ReadAttribute { public: - ReadAdministratorCommissioningAdminFabricIndex() - : ReadAttribute("admin-fabric-index") - { - } - - ~ReadAdministratorCommissioningAdminFabricIndex() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAdminFabricIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning AdminFabricIndex read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlWindSupport() : ReadAttribute("wind-support") {} + + ~ReadFanControlWindSupport() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWindSupportWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.WindSupport response %@", [value description]); + if (error != nil) { + LogNSError("FanControl WindSupport read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAdministratorCommissioningAdminFabricIndex : public SubscribeAttribute { +class SubscribeAttributeFanControlWindSupport : public SubscribeAttribute { public: - SubscribeAttributeAdministratorCommissioningAdminFabricIndex() - : SubscribeAttribute("admin-fabric-index") - { - } + SubscribeAttributeFanControlWindSupport() + : SubscribeAttribute("wind-support") {} - ~SubscribeAttributeAdministratorCommissioningAdminFabricIndex() {} + ~SubscribeAttributeFanControlWindSupport() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWindSupportWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAdminFabricIndexWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.WindSupport response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AdminVendorId + * Attribute WindSetting */ -class ReadAdministratorCommissioningAdminVendorId : public ReadAttribute { +class ReadFanControlWindSetting : public ReadAttribute { public: - ReadAdministratorCommissioningAdminVendorId() - : ReadAttribute("admin-vendor-id") - { - } - - ~ReadAdministratorCommissioningAdminVendorId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAdminVendorIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AdminVendorId response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning AdminVendorId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlWindSetting() : ReadAttribute("wind-setting") {} + + ~ReadFanControlWindSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWindSettingWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.WindSetting response %@", [value description]); + if (error != nil) { + LogNSError("FanControl WindSetting read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAdministratorCommissioningAdminVendorId : public SubscribeAttribute { +class WriteFanControlWindSetting : public WriteAttribute { public: - SubscribeAttributeAdministratorCommissioningAdminVendorId() - : SubscribeAttribute("admin-vendor-id") - { - } - - ~SubscribeAttributeAdministratorCommissioningAdminVendorId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAdminVendorIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AdminVendorId response %@", [value description]); - SetCommandExitStatus(error); - }]; + WriteFanControlWindSetting() : WriteAttribute("wind-setting") { + AddArgument("attr-name", "wind-setting"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteFanControlWindSetting() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) WriteAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeWindSettingWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "FanControl WindSetting write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -/* - * Attribute GeneratedCommandList - */ -class ReadAdministratorCommissioningGeneratedCommandList : public ReadAttribute { +class SubscribeAttributeFanControlWindSetting : public SubscribeAttribute { public: - ReadAdministratorCommissioningGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadAdministratorCommissioningGeneratedCommandList() {} + SubscribeAttributeFanControlWindSetting() + : SubscribeAttribute("wind-setting") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); + ~SubscribeAttributeFanControlWindSetting() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeAdministratorCommissioningGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAdministratorCommissioningGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeAdministratorCommissioningGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWindSettingWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.WindSetting response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute GeneratedCommandList */ -class ReadAdministratorCommissioningAcceptedCommandList : public ReadAttribute { +class ReadFanControlGeneratedCommandList : public ReadAttribute { public: - ReadAdministratorCommissioningAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadAdministratorCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadFanControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("FanControl GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFanControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFanControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeFanControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAdministratorCommissioningAcceptedCommandList : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadFanControlAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeAdministratorCommissioningAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeAdministratorCommissioningAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadFanControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadFanControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("FanControl AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFanControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFanControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeFanControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* * Attribute AttributeList */ -class ReadAdministratorCommissioningAttributeList : public ReadAttribute { +class ReadFanControlAttributeList : public ReadAttribute { public: - ReadAdministratorCommissioningAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadAdministratorCommissioningAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadFanControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("FanControl AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAdministratorCommissioningAttributeList : public SubscribeAttribute { +class SubscribeAttributeFanControlAttributeList : public SubscribeAttribute { public: - SubscribeAttributeAdministratorCommissioningAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeFanControlAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeAdministratorCommissioningAttributeList() {} + ~SubscribeAttributeFanControlAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute FeatureMap */ -class ReadAdministratorCommissioningFeatureMap : public ReadAttribute { +class ReadFanControlFeatureMap : public ReadAttribute { public: - ReadAdministratorCommissioningFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadAdministratorCommissioningFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFanControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadFanControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FanControl.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("FanControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeAdministratorCommissioningFeatureMap : public SubscribeAttribute { +class SubscribeAttributeFanControlFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeAdministratorCommissioningFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeFanControlFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeAdministratorCommissioningFeatureMap() {} + ~SubscribeAttributeFanControlFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute ClusterRevision */ -class ReadAdministratorCommissioningClusterRevision : public ReadAttribute { +class ReadFanControlClusterRevision : public ReadAttribute { public: - ReadAdministratorCommissioningClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadFanControlClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadFanControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("FanControl ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadAdministratorCommissioningClusterRevision() {} +class SubscribeAttributeFanControlClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeFanControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeFanControlClusterRevision() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("AdministratorCommissioning ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000202) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFanControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeAdministratorCommissioningClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeAdministratorCommissioningClusterRevision() - : SubscribeAttribute("cluster-revision") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeAdministratorCommissioningClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003C) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AdministratorCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FanControl.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster OperationalCredentials | 0x003E | +| Cluster ThermostatUserInterfaceConfiguration | 0x0204 | |------------------------------------------------------------------------------| | Commands: | | -| * AttestationRequest | 0x00 | -| * CertificateChainRequest | 0x02 | -| * CSRRequest | 0x04 | -| * AddNOC | 0x06 | -| * UpdateNOC | 0x07 | -| * UpdateFabricLabel | 0x09 | -| * RemoveFabric | 0x0A | -| * AddTrustedRootCertificate | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | -| * NOCs | 0x0000 | -| * Fabrics | 0x0001 | -| * SupportedFabrics | 0x0002 | -| * CommissionedFabrics | 0x0003 | -| * TrustedRootCertificates | 0x0004 | -| * CurrentFabricIndex | 0x0005 | +| * TemperatureDisplayMode | 0x0000 | +| * KeypadLockout | 0x0001 | +| * ScheduleProgrammingVisibility | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -33316,52389 +64332,36791 @@ class SubscribeAttributeAdministratorCommissioningClusterRevision : public Subsc \*----------------------------------------------------------------------------*/ /* - * Command AttestationRequest + * Attribute TemperatureDisplayMode */ -class OperationalCredentialsAttestationRequest : public ClusterCommand { -public: - OperationalCredentialsAttestationRequest() - : ClusterCommand("attestation-request") - { - AddArgument("AttestationNonce", &mRequest.attestationNonce); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterAttestationRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.attestationNonce = [NSData dataWithBytes:mRequest.attestationNonce.data() length:mRequest.attestationNonce.size()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster attestationRequestWithParams:params - completion:^(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } +class ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() + : ReadAttribute("temperature-display-mode") {} + + ~ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTemperatureDisplayModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ThermostatUserInterfaceConfiguration " + "TemperatureDisplayMode read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode + : public WriteAttribute { +public: + WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() + : WriteAttribute("temperature-display-mode") { + AddArgument("attr-name", "temperature-display-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeTemperatureDisplayModeWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ThermostatUserInterf" + "aceConfiguration " + "TemperatureDisplayMo" + "de write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Type mRequest; + uint8_t mValue; }; -/* - * Command CertificateChainRequest - */ -class OperationalCredentialsCertificateChainRequest : public ClusterCommand { +class + SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode + : public SubscribeAttribute { public: - OperationalCredentialsCertificateChainRequest() - : ClusterCommand("certificate-chain-request") - { - AddArgument("CertificateType", 0, UINT8_MAX, &mRequest.certificateType); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterCertificateChainRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.certificateType = [NSNumber numberWithUnsignedChar:mRequest.certificateType]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster certificateChainRequestWithParams:params - completion:^( - MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() + : SubscribeAttribute("temperature-display-mode") {} -private: - chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Type mRequest; -}; + ~SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() { + } -/* - * Command CSRRequest - */ -class OperationalCredentialsCSRRequest : public ClusterCommand { -public: - OperationalCredentialsCSRRequest() - : ClusterCommand("csrrequest") - { - AddArgument("CSRNonce", &mRequest.CSRNonce); - AddArgument("IsForUpdateNOC", 0, 1, &mRequest.isForUpdateNOC); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterCSRRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.csrNonce = [NSData dataWithBytes:mRequest.CSRNonce.data() length:mRequest.CSRNonce.size()]; - if (mRequest.isForUpdateNOC.HasValue()) { - params.isForUpdateNOC = [NSNumber numberWithBool:mRequest.isForUpdateNOC.Value()]; - } else { - params.isForUpdateNOC = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster CSRRequestWithParams:params - completion:^(MTROperationalCredentialsClusterCSRResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } - -private: - chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Type mRequest; -}; - -/* - * Command AddNOC - */ -class OperationalCredentialsAddNOC : public ClusterCommand { -public: - OperationalCredentialsAddNOC() - : ClusterCommand("add-noc") - { - AddArgument("NOCValue", &mRequest.NOCValue); - AddArgument("ICACValue", &mRequest.ICACValue); - AddArgument("IPKValue", &mRequest.IPKValue); - AddArgument("CaseAdminSubject", 0, UINT64_MAX, &mRequest.caseAdminSubject); - AddArgument("AdminVendorId", 0, UINT16_MAX, &mRequest.adminVendorId); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterAddNOCParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() length:mRequest.NOCValue.size()]; - if (mRequest.ICACValue.HasValue()) { - params.icacValue = [NSData dataWithBytes:mRequest.ICACValue.Value().data() length:mRequest.ICACValue.Value().size()]; - } else { - params.icacValue = nil; - } - params.ipkValue = [NSData dataWithBytes:mRequest.IPKValue.data() length:mRequest.IPKValue.size()]; - params.caseAdminSubject = [NSNumber numberWithUnsignedLongLong:mRequest.caseAdminSubject]; - params.adminVendorId = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.adminVendorId)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster addNOCWithParams:params - completion:^( - MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTemperatureDisplayModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command UpdateNOC + * Attribute KeypadLockout */ -class OperationalCredentialsUpdateNOC : public ClusterCommand { -public: - OperationalCredentialsUpdateNOC() - : ClusterCommand("update-noc") - { - AddArgument("NOCValue", &mRequest.NOCValue); - AddArgument("ICACValue", &mRequest.ICACValue); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterUpdateNOCParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() length:mRequest.NOCValue.size()]; - if (mRequest.ICACValue.HasValue()) { - params.icacValue = [NSData dataWithBytes:mRequest.ICACValue.Value().data() length:mRequest.ICACValue.Value().size()]; - } else { - params.icacValue = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster updateNOCWithParams:params - completion:^( - MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } +class ReadThermostatUserInterfaceConfigurationKeypadLockout + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationKeypadLockout() + : ReadAttribute("keypad-lockout") {} + + ~ReadThermostatUserInterfaceConfigurationKeypadLockout() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeKeypadLockoutWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThermostatUserInterfaceConfiguration KeypadLockout read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteThermostatUserInterfaceConfigurationKeypadLockout + : public WriteAttribute { +public: + WriteThermostatUserInterfaceConfigurationKeypadLockout() + : WriteAttribute("keypad-lockout") { + AddArgument("attr-name", "keypad-lockout"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUserInterfaceConfigurationKeypadLockout() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeKeypadLockoutWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ThermostatUserInterfaceConfiguration" + " KeypadLockout write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type mRequest; + uint8_t mValue; }; -/* - * Command UpdateFabricLabel - */ -class OperationalCredentialsUpdateFabricLabel : public ClusterCommand { +class SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout + : public SubscribeAttribute { public: - OperationalCredentialsUpdateFabricLabel() - : ClusterCommand("update-fabric-label") - { - AddArgument("Label", &mRequest.label); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterUpdateFabricLabelParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.label = [[NSString alloc] initWithBytes:mRequest.label.data() - length:mRequest.label.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster updateFabricLabelWithParams:params - completion:^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() + : SubscribeAttribute("keypad-lockout") {} -private: - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type mRequest; -}; + ~SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() {} -/* - * Command RemoveFabric - */ -class OperationalCredentialsRemoveFabric : public ClusterCommand { -public: - OperationalCredentialsRemoveFabric() - : ClusterCommand("remove-fabric") - { - AddArgument("FabricIndex", 0, UINT8_MAX, &mRequest.fabricIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.fabricIndex = [NSNumber numberWithUnsignedChar:mRequest.fabricIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster removeFabricWithParams:params - completion:^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeKeypadLockoutWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command AddTrustedRootCertificate + * Attribute ScheduleProgrammingVisibility */ -class OperationalCredentialsAddTrustedRootCertificate : public ClusterCommand { -public: - OperationalCredentialsAddTrustedRootCertificate() - : ClusterCommand("add-trusted-root-certificate") - { - AddArgument("RootCertificate", &mRequest.rootCertificate); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) command (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTROperationalCredentialsClusterAddTrustedRootCertificateParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.rootCertificate = [NSData dataWithBytes:mRequest.rootCertificate.data() length:mRequest.rootCertificate.size()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster addTrustedRootCertificateWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } +class ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() + : ReadAttribute("schedule-programming-visibility") {} + + ~ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeScheduleProgrammingVisibilityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration." + @"ScheduleProgrammingVisibility response %@", + [value description]); + if (error != nil) { + LogNSError("ThermostatUserInterfaceConfiguration " + "ScheduleProgrammingVisibility read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility + : public WriteAttribute { +public: + WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() + : WriteAttribute("schedule-programming-visibility") { + AddArgument("attr-name", "schedule-programming-visibility"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) WriteAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeScheduleProgrammingVisibilityWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "ThermostatUserInterf" + "aceConfiguration " + "ScheduleProgrammingV" + "isibility write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Type mRequest; + uint8_t mValue; }; -/* - * Attribute NOCs - */ -class ReadOperationalCredentialsNOCs : public ReadAttribute { +class + SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility + : public SubscribeAttribute { public: - ReadOperationalCredentialsNOCs() - : ReadAttribute("nocs") - { - } - - ~ReadOperationalCredentialsNOCs() {} + SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() + : SubscribeAttribute("schedule-programming-visibility") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000000) on endpoint %u", endpointId); + ~SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() { + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeNOCsWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.NOCs response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials NOCs read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeOperationalCredentialsNOCs : public SubscribeAttribute { -public: - SubscribeAttributeOperationalCredentialsNOCs() - : SubscribeAttribute("nocs") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeOperationalCredentialsNOCs() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeScheduleProgrammingVisibilityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNOCsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.NOCs response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration." + @"ScheduleProgrammingVisibility response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Fabrics + * Attribute GeneratedCommandList */ -class ReadOperationalCredentialsFabrics : public ReadAttribute { -public: - ReadOperationalCredentialsFabrics() - : ReadAttribute("fabrics") - { - } - - ~ReadOperationalCredentialsFabrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeFabricsWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.Fabrics response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials Fabrics read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadThermostatUserInterfaceConfigurationGeneratedCommandList + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadThermostatUserInterfaceConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ThermostatUserInterfaceConfiguration GeneratedCommandList " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOperationalCredentialsFabrics : public SubscribeAttribute { -public: - SubscribeAttributeOperationalCredentialsFabrics() - : SubscribeAttribute("fabrics") - { - } - - ~SubscribeAttributeOperationalCredentialsFabrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFabricsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.Fabrics response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadThermostatUserInterfaceConfigurationAcceptedCommandList + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadThermostatUserInterfaceConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ThermostatUserInterfaceConfiguration AcceptedCommandList " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SupportedFabrics + * Attribute AttributeList */ -class ReadOperationalCredentialsSupportedFabrics : public ReadAttribute { -public: - ReadOperationalCredentialsSupportedFabrics() - : ReadAttribute("supported-fabrics") - { - } - - ~ReadOperationalCredentialsSupportedFabrics() {} +class ReadThermostatUserInterfaceConfigurationAttributeList + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadThermostatUserInterfaceConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThermostatUserInterfaceConfiguration AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ThermostatUserInterfaceConfiguration.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000002) on endpoint %u", endpointId); +/* + * Attribute FeatureMap + */ +class ReadThermostatUserInterfaceConfigurationFeatureMap + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationFeatureMap() + : ReadAttribute("feature-map") {} + + ~ReadThermostatUserInterfaceConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("ThermostatUserInterfaceConfiguration FeatureMap read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportedFabricsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.SupportedFabrics response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials SupportedFabrics read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadThermostatUserInterfaceConfigurationClusterRevision + : public ReadAttribute { +public: + ReadThermostatUserInterfaceConfigurationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadThermostatUserInterfaceConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError( + "ThermostatUserInterfaceConfiguration ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000204) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeOperationalCredentialsSupportedFabrics : public SubscribeAttribute { -public: - SubscribeAttributeOperationalCredentialsSupportedFabrics() - : SubscribeAttribute("supported-fabrics") - { - } - - ~SubscribeAttributeOperationalCredentialsSupportedFabrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSupportedFabricsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.SupportedFabrics response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster ColorControl | 0x0300 | +|------------------------------------------------------------------------------| +| Commands: | | +| * MoveToHue | 0x00 | +| * MoveHue | 0x01 | +| * StepHue | 0x02 | +| * MoveToSaturation | 0x03 | +| * MoveSaturation | 0x04 | +| * StepSaturation | 0x05 | +| * MoveToHueAndSaturation | 0x06 | +| * MoveToColor | 0x07 | +| * MoveColor | 0x08 | +| * StepColor | 0x09 | +| * MoveToColorTemperature | 0x0A | +| * EnhancedMoveToHue | 0x40 | +| * EnhancedMoveHue | 0x41 | +| * EnhancedStepHue | 0x42 | +| * EnhancedMoveToHueAndSaturation | 0x43 | +| * ColorLoopSet | 0x44 | +| * StopMoveStep | 0x47 | +| * MoveColorTemperature | 0x4B | +| * StepColorTemperature | 0x4C | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CurrentHue | 0x0000 | +| * CurrentSaturation | 0x0001 | +| * RemainingTime | 0x0002 | +| * CurrentX | 0x0003 | +| * CurrentY | 0x0004 | +| * DriftCompensation | 0x0005 | +| * CompensationText | 0x0006 | +| * ColorTemperatureMireds | 0x0007 | +| * ColorMode | 0x0008 | +| * Options | 0x000F | +| * NumberOfPrimaries | 0x0010 | +| * Primary1X | 0x0011 | +| * Primary1Y | 0x0012 | +| * Primary1Intensity | 0x0013 | +| * Primary2X | 0x0015 | +| * Primary2Y | 0x0016 | +| * Primary2Intensity | 0x0017 | +| * Primary3X | 0x0019 | +| * Primary3Y | 0x001A | +| * Primary3Intensity | 0x001B | +| * Primary4X | 0x0020 | +| * Primary4Y | 0x0021 | +| * Primary4Intensity | 0x0022 | +| * Primary5X | 0x0024 | +| * Primary5Y | 0x0025 | +| * Primary5Intensity | 0x0026 | +| * Primary6X | 0x0028 | +| * Primary6Y | 0x0029 | +| * Primary6Intensity | 0x002A | +| * WhitePointX | 0x0030 | +| * WhitePointY | 0x0031 | +| * ColorPointRX | 0x0032 | +| * ColorPointRY | 0x0033 | +| * ColorPointRIntensity | 0x0034 | +| * ColorPointGX | 0x0036 | +| * ColorPointGY | 0x0037 | +| * ColorPointGIntensity | 0x0038 | +| * ColorPointBX | 0x003A | +| * ColorPointBY | 0x003B | +| * ColorPointBIntensity | 0x003C | +| * EnhancedCurrentHue | 0x4000 | +| * EnhancedColorMode | 0x4001 | +| * ColorLoopActive | 0x4002 | +| * ColorLoopDirection | 0x4003 | +| * ColorLoopTime | 0x4004 | +| * ColorLoopStartEnhancedHue | 0x4005 | +| * ColorLoopStoredEnhancedHue | 0x4006 | +| * ColorCapabilities | 0x400A | +| * ColorTempPhysicalMinMireds | 0x400B | +| * ColorTempPhysicalMaxMireds | 0x400C | +| * CoupleColorTempToLevelMinMireds | 0x400D | +| * StartUpColorTemperatureMireds | 0x4010 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ /* - * Attribute CommissionedFabrics + * Command MoveToHue */ -class ReadOperationalCredentialsCommissionedFabrics : public ReadAttribute { +class ColorControlMoveToHue : public ClusterCommand { public: - ReadOperationalCredentialsCommissionedFabrics() - : ReadAttribute("commissioned-fabrics") - { + ColorControlMoveToHue() : ClusterCommand("move-to-hue") { + AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); + AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRColorControlClusterMoveToHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; + params.direction = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsCommissionedFabrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCommissionedFabricsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.CommissionedFabrics response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials CommissionedFabrics read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type mRequest; }; -class SubscribeAttributeOperationalCredentialsCommissionedFabrics : public SubscribeAttribute { +/* + * Command MoveHue + */ +class ColorControlMoveHue : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsCommissionedFabrics() - : SubscribeAttribute("commissioned-fabrics") - { + ColorControlMoveHue() : ClusterCommand("move-hue") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRColorControlClusterMoveHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsCommissionedFabrics() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCommissionedFabricsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.CommissionedFabrics response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveHue::Type mRequest; }; /* - * Attribute TrustedRootCertificates + * Command StepHue */ -class ReadOperationalCredentialsTrustedRootCertificates : public ReadAttribute { +class ColorControlStepHue : public ClusterCommand { public: - ReadOperationalCredentialsTrustedRootCertificates() - : ReadAttribute("trusted-root-certificates") - { + ColorControlStepHue() : ClusterCommand("step-hue") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRColorControlClusterStepHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; + params.transitionTime = + [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsTrustedRootCertificates() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTrustedRootCertificatesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials TrustedRootCertificates read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::StepHue::Type mRequest; }; -class SubscribeAttributeOperationalCredentialsTrustedRootCertificates : public SubscribeAttribute { +/* + * Command MoveToSaturation + */ +class ColorControlMoveToSaturation : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsTrustedRootCertificates() - : SubscribeAttribute("trusted-root-certificates") - { + ColorControlMoveToSaturation() : ClusterCommand("move-to-saturation") { + AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveToSaturationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToSaturationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsTrustedRootCertificates() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTrustedRootCertificatesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type mRequest; }; /* - * Attribute CurrentFabricIndex + * Command MoveSaturation */ -class ReadOperationalCredentialsCurrentFabricIndex : public ReadAttribute { +class ColorControlMoveSaturation : public ClusterCommand { public: - ReadOperationalCredentialsCurrentFabricIndex() - : ReadAttribute("current-fabric-index") - { + ColorControlMoveSaturation() : ClusterCommand("move-saturation") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveSaturationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveSaturationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsCurrentFabricIndex() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentFabricIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials CurrentFabricIndex read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type mRequest; }; -class SubscribeAttributeOperationalCredentialsCurrentFabricIndex : public SubscribeAttribute { +/* + * Command StepSaturation + */ +class ColorControlStepSaturation : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsCurrentFabricIndex() - : SubscribeAttribute("current-fabric-index") - { + ColorControlStepSaturation() : ClusterCommand("step-saturation") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterStepSaturationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; + params.transitionTime = + [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepSaturationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsCurrentFabricIndex() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentFabricIndexWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::StepSaturation::Type mRequest; }; /* - * Attribute GeneratedCommandList + * Command MoveToHueAndSaturation */ -class ReadOperationalCredentialsGeneratedCommandList : public ReadAttribute { +class ColorControlMoveToHueAndSaturation : public ClusterCommand { public: - ReadOperationalCredentialsGeneratedCommandList() - : ReadAttribute("generated-command-list") - { + ColorControlMoveToHueAndSaturation() + : ClusterCommand("move-to-hue-and-saturation") { + AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); + AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveToHueAndSaturationParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; + params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToHueAndSaturationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type + mRequest; }; -class SubscribeAttributeOperationalCredentialsGeneratedCommandList : public SubscribeAttribute { +/* + * Command MoveToColor + */ +class ColorControlMoveToColor : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { + ColorControlMoveToColor() : ClusterCommand("move-to-color") { + AddArgument("ColorX", 0, UINT16_MAX, &mRequest.colorX); + AddArgument("ColorY", 0, UINT16_MAX, &mRequest.colorY); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveToColorParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.colorX = [NSNumber numberWithUnsignedShort:mRequest.colorX]; + params.colorY = [NSNumber numberWithUnsignedShort:mRequest.colorY]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToColorWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveToColor::Type mRequest; }; /* - * Attribute AcceptedCommandList + * Command MoveColor */ -class ReadOperationalCredentialsAcceptedCommandList : public ReadAttribute { +class ColorControlMoveColor : public ClusterCommand { public: - ReadOperationalCredentialsAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { + ColorControlMoveColor() : ClusterCommand("move-color") { + AddArgument("RateX", INT16_MIN, INT16_MAX, &mRequest.rateX); + AddArgument("RateY", INT16_MIN, INT16_MAX, &mRequest.rateY); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRColorControlClusterMoveColorParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.rateX = [NSNumber numberWithShort:mRequest.rateX]; + params.rateY = [NSNumber numberWithShort:mRequest.rateY]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveColorWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveColor::Type mRequest; }; -class SubscribeAttributeOperationalCredentialsAcceptedCommandList : public SubscribeAttribute { +/* + * Command StepColor + */ +class ColorControlStepColor : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { + ColorControlStepColor() : ClusterCommand("step-color") { + AddArgument("StepX", INT16_MIN, INT16_MAX, &mRequest.stepX); + AddArgument("StepY", INT16_MIN, INT16_MAX, &mRequest.stepY); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000009) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRColorControlClusterStepColorParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepX = [NSNumber numberWithShort:mRequest.stepX]; + params.stepY = [NSNumber numberWithShort:mRequest.stepY]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepColorWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::StepColor::Type mRequest; }; /* - * Attribute AttributeList + * Command MoveToColorTemperature */ -class ReadOperationalCredentialsAttributeList : public ReadAttribute { +class ColorControlMoveToColorTemperature : public ClusterCommand { public: - ReadOperationalCredentialsAttributeList() - : ReadAttribute("attribute-list") - { + ColorControlMoveToColorTemperature() + : ClusterCommand("move-to-color-temperature") { + AddArgument("ColorTemperature", 0, UINT16_MAX, &mRequest.colorTemperature); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x0000000A) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveToColorTemperatureParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.colorTemperature = + [NSNumber numberWithUnsignedShort:mRequest.colorTemperature]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToColorTemperatureWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type + mRequest; }; -class SubscribeAttributeOperationalCredentialsAttributeList : public SubscribeAttribute { +/* + * Command EnhancedMoveToHue + */ +class ColorControlEnhancedMoveToHue : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsAttributeList() - : SubscribeAttribute("attribute-list") - { + ColorControlEnhancedMoveToHue() : ClusterCommand("enhanced-move-to-hue") { + AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); + AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000040) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.enhancedHue = + [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; + params.direction = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster enhancedMoveToHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type mRequest; }; /* - * Attribute FeatureMap + * Command EnhancedMoveHue */ -class ReadOperationalCredentialsFeatureMap : public ReadAttribute { +class ColorControlEnhancedMoveHue : public ClusterCommand { public: - ReadOperationalCredentialsFeatureMap() - : ReadAttribute("feature-map") - { + ColorControlEnhancedMoveHue() : ClusterCommand("enhanced-move-hue") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000041) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterEnhancedMoveHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster enhancedMoveHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type mRequest; }; -class SubscribeAttributeOperationalCredentialsFeatureMap : public SubscribeAttribute { +/* + * Command EnhancedStepHue + */ +class ColorControlEnhancedStepHue : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsFeatureMap() - : SubscribeAttribute("feature-map") - { + ColorControlEnhancedStepHue() : ClusterCommand("enhanced-step-hue") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000042) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterEnhancedStepHueParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster enhancedStepHueWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type mRequest; }; /* - * Attribute ClusterRevision + * Command EnhancedMoveToHueAndSaturation */ -class ReadOperationalCredentialsClusterRevision : public ReadAttribute { +class ColorControlEnhancedMoveToHueAndSaturation : public ClusterCommand { public: - ReadOperationalCredentialsClusterRevision() - : ReadAttribute("cluster-revision") - { + ColorControlEnhancedMoveToHueAndSaturation() + : ClusterCommand("enhanced-move-to-hue-and-saturation") { + AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); + AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000043) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterEnhancedMoveToHueAndSaturationParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.enhancedHue = + [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; + params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + enhancedMoveToHueAndSaturationWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadOperationalCredentialsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OperationalCredentials ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation:: + Type mRequest; }; -class SubscribeAttributeOperationalCredentialsClusterRevision : public SubscribeAttribute { +/* + * Command ColorLoopSet + */ +class ColorControlColorLoopSet : public ClusterCommand { public: - SubscribeAttributeOperationalCredentialsClusterRevision() - : SubscribeAttribute("cluster-revision") - { + ColorControlColorLoopSet() : ClusterCommand("color-loop-set") { + AddArgument("UpdateFlags", 0, UINT8_MAX, &mRequest.updateFlags); + AddArgument("Action", 0, UINT8_MAX, &mRequest.action); + AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); + AddArgument("Time", 0, UINT16_MAX, &mRequest.time); + AddArgument("StartHue", 0, UINT16_MAX, &mRequest.startHue); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000044) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.updateFlags = + [NSNumber numberWithUnsignedChar:mRequest.updateFlags.Raw()]; + params.action = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.action)]; + params.direction = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; + params.time = [NSNumber numberWithUnsignedShort:mRequest.time]; + params.startHue = [NSNumber numberWithUnsignedShort:mRequest.startHue]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster colorLoopSetWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeOperationalCredentialsClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003E) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OperationalCredentials.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type mRequest; }; -/*----------------------------------------------------------------------------*\ -| Cluster GroupKeyManagement | 0x003F | -|------------------------------------------------------------------------------| -| Commands: | | -| * KeySetWrite | 0x00 | -| * KeySetRead | 0x01 | -| * KeySetRemove | 0x03 | -| * KeySetReadAllIndices | 0x04 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * GroupKeyMap | 0x0000 | -| * GroupTable | 0x0001 | -| * MaxGroupsPerFabric | 0x0002 | -| * MaxGroupKeysPerFabric | 0x0003 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Command KeySetWrite + * Command StopMoveStep */ -class GroupKeyManagementKeySetWrite : public ClusterCommand { +class ColorControlStopMoveStep : public ClusterCommand { public: - GroupKeyManagementKeySetWrite() - : ClusterCommand("key-set-write") - , mComplex_GroupKeySet(&mRequest.groupKeySet) - { - AddArgument("GroupKeySet", &mComplex_GroupKeySet); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupKeySet = [MTRGroupKeyManagementClusterGroupKeySetStruct new]; - params.groupKeySet.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySet.groupKeySetID]; - params.groupKeySet.groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.groupKeySet.groupKeySecurityPolicy)]; - if (mRequest.groupKeySet.epochKey0.IsNull()) { - params.groupKeySet.epochKey0 = nil; - } else { - params.groupKeySet.epochKey0 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey0.Value().data() - length:mRequest.groupKeySet.epochKey0.Value().size()]; - } - if (mRequest.groupKeySet.epochStartTime0.IsNull()) { - params.groupKeySet.epochStartTime0 = nil; - } else { - params.groupKeySet.epochStartTime0 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime0.Value()]; - } - if (mRequest.groupKeySet.epochKey1.IsNull()) { - params.groupKeySet.epochKey1 = nil; - } else { - params.groupKeySet.epochKey1 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey1.Value().data() - length:mRequest.groupKeySet.epochKey1.Value().size()]; - } - if (mRequest.groupKeySet.epochStartTime1.IsNull()) { - params.groupKeySet.epochStartTime1 = nil; - } else { - params.groupKeySet.epochStartTime1 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime1.Value()]; - } - if (mRequest.groupKeySet.epochKey2.IsNull()) { - params.groupKeySet.epochKey2 = nil; - } else { - params.groupKeySet.epochKey2 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey2.Value().data() - length:mRequest.groupKeySet.epochKey2.Value().size()]; - } - if (mRequest.groupKeySet.epochStartTime2.IsNull()) { - params.groupKeySet.epochStartTime2 = nil; - } else { - params.groupKeySet.epochStartTime2 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime2.Value()]; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster keySetWriteWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + ColorControlStopMoveStep() : ClusterCommand("stop-move-step") { + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x00000047) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterStopMoveStepParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopMoveStepWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type mRequest; - TypedComplexArgument mComplex_GroupKeySet; + chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type mRequest; }; /* - * Command KeySetRead + * Command MoveColorTemperature */ -class GroupKeyManagementKeySetRead : public ClusterCommand { +class ColorControlMoveColorTemperature : public ClusterCommand { public: - GroupKeyManagementKeySetRead() - : ClusterCommand("key-set-read") - { - AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetReadParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster keySetReadWithParams:params - completion:^(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { + ColorControlMoveColorTemperature() + : ClusterCommand("move-color-temperature") { + AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); + AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); + AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, + &mRequest.colorTemperatureMinimumMireds); + AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, + &mRequest.colorTemperatureMaximumMireds); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x0000004B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterMoveColorTemperatureParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.moveMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; + params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; + params.colorTemperatureMinimumMireds = [NSNumber + numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; + params.colorTemperatureMaximumMireds = [NSNumber + numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveColorTemperatureWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { mError = error; LogNSError("Error", error); - } - if (responsesNeeded == 0) { + } + if (responsesNeeded == 0) { SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type mRequest; + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type + mRequest; }; /* - * Command KeySetRemove + * Command StepColorTemperature */ -class GroupKeyManagementKeySetRemove : public ClusterCommand { +class ColorControlStepColorTemperature : public ClusterCommand { public: - GroupKeyManagementKeySetRemove() - : ClusterCommand("key-set-remove") - { - AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetRemoveParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster keySetRemoveWithParams:params - completion:^(NSError * _Nullable error) { + ColorControlStepColorTemperature() + : ClusterCommand("step-color-temperature") { + AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); + AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); + AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); + AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, + &mRequest.colorTemperatureMinimumMireds); + AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, + &mRequest.colorTemperatureMaximumMireds); + AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); + AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000300) command (0x0000004C) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRColorControlClusterStepColorTemperatureParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.stepMode = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; + params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; + params.transitionTime = + [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; + params.colorTemperatureMinimumMireds = [NSNumber + numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; + params.colorTemperatureMaximumMireds = [NSNumber + numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; + params.optionsOverride = + [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stepColorTemperatureWithParams:params + completion:^(NSError *_Nullable error) { responsesNeeded--; if (error != nil) { - mError = error; - LogNSError("Error", error); + mError = error; + LogNSError("Error", error); } if (responsesNeeded == 0) { - SetCommandExitStatus(mError); + SetCommandExitStatus(mError); } - }]; - } - return CHIP_NO_ERROR; + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type mRequest; + chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type + mRequest; }; /* - * Command KeySetReadAllIndices + * Attribute CurrentHue */ -class GroupKeyManagementKeySetReadAllIndices : public ClusterCommand { +class ReadColorControlCurrentHue : public ReadAttribute { public: - GroupKeyManagementKeySetReadAllIndices() - : ClusterCommand("key-set-read-all-indices") - , mComplex_GroupKeySetIDs(&mRequest.groupKeySetIDs) - { - AddArgument("GroupKeySetIDs", &mComplex_GroupKeySetIDs); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetReadAllIndicesParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.groupKeySetIDs) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; - [array_0 addObject:newElement_0]; - } - params.groupKeySetIDs = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - keySetReadAllIndicesWithParams:params - completion:^(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type mRequest; - TypedComplexArgument> mComplex_GroupKeySetIDs; + ReadColorControlCurrentHue() : ReadAttribute("current-hue") {} + + ~ReadColorControlCurrentHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentHueWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentHue response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl CurrentHue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Attribute GroupKeyMap - */ -class ReadGroupKeyManagementGroupKeyMap : public ReadAttribute { +class SubscribeAttributeColorControlCurrentHue : public SubscribeAttribute { public: - ReadGroupKeyManagementGroupKeyMap() - : ReadAttribute("group-key-map") - { - } + SubscribeAttributeColorControlCurrentHue() + : SubscribeAttribute("current-hue") {} - ~ReadGroupKeyManagementGroupKeyMap() {} + ~SubscribeAttributeColorControlCurrentHue() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeGroupKeyMapWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GroupKeyMap response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement GroupKeyMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentHueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentHue response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteGroupKeyManagementGroupKeyMap : public WriteAttribute { +/* + * Attribute CurrentSaturation + */ +class ReadColorControlCurrentSaturation : public ReadAttribute { public: - WriteGroupKeyManagementGroupKeyMap() - : WriteAttribute("group-key-map") - , mComplex(&mValue) - { - AddArgument("attr-name", "group-key-map"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteGroupKeyManagementGroupKeyMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; - newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; - newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; - newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeGroupKeyMapWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("GroupKeyManagement GroupKeyMap write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlCurrentSaturation() : ReadAttribute("current-saturation") {} + + ~ReadColorControlCurrentSaturation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentSaturationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl CurrentSaturation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlCurrentSaturation + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlCurrentSaturation() + : SubscribeAttribute("current-saturation") {} + + ~SubscribeAttributeColorControlCurrentSaturation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentSaturationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentSaturation response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; -private: - chip::app::DataModel::List mValue; - TypedComplexArgument< - chip::app::DataModel::List> - mComplex; +/* + * Attribute RemainingTime + */ +class ReadColorControlRemainingTime : public ReadAttribute { +public: + ReadColorControlRemainingTime() : ReadAttribute("remaining-time") {} + + ~ReadColorControlRemainingTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRemainingTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.RemainingTime response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl RemainingTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementGroupKeyMap : public SubscribeAttribute { +class SubscribeAttributeColorControlRemainingTime : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementGroupKeyMap() - : SubscribeAttribute("group-key-map") - { - } + SubscribeAttributeColorControlRemainingTime() + : SubscribeAttribute("remaining-time") {} - ~SubscribeAttributeGroupKeyManagementGroupKeyMap() {} + ~SubscribeAttributeColorControlRemainingTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRemainingTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGroupKeyMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GroupKeyMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.RemainingTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GroupTable + * Attribute CurrentX */ -class ReadGroupKeyManagementGroupTable : public ReadAttribute { +class ReadColorControlCurrentX : public ReadAttribute { public: - ReadGroupKeyManagementGroupTable() - : ReadAttribute("group-table") - { - } - - ~ReadGroupKeyManagementGroupTable() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeGroupTableWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GroupTable response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement GroupTable read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlCurrentX() : ReadAttribute("current-x") {} + + ~ReadColorControlCurrentX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentXWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentX response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl CurrentX read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementGroupTable : public SubscribeAttribute { +class SubscribeAttributeColorControlCurrentX : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementGroupTable() - : SubscribeAttribute("group-table") - { - } + SubscribeAttributeColorControlCurrentX() : SubscribeAttribute("current-x") {} - ~SubscribeAttributeGroupKeyManagementGroupTable() {} + ~SubscribeAttributeColorControlCurrentX() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentXWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGroupTableWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GroupTable response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentX response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MaxGroupsPerFabric + * Attribute CurrentY */ -class ReadGroupKeyManagementMaxGroupsPerFabric : public ReadAttribute { +class ReadColorControlCurrentY : public ReadAttribute { public: - ReadGroupKeyManagementMaxGroupsPerFabric() - : ReadAttribute("max-groups-per-fabric") - { - } - - ~ReadGroupKeyManagementMaxGroupsPerFabric() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxGroupsPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement MaxGroupsPerFabric read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlCurrentY() : ReadAttribute("current-y") {} + + ~ReadColorControlCurrentY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentYWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentY response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl CurrentY read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric : public SubscribeAttribute { +class SubscribeAttributeColorControlCurrentY : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() - : SubscribeAttribute("max-groups-per-fabric") - { - } + SubscribeAttributeColorControlCurrentY() : SubscribeAttribute("current-y") {} - ~SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() {} + ~SubscribeAttributeColorControlCurrentY() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentYWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMaxGroupsPerFabricWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CurrentY response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MaxGroupKeysPerFabric + * Attribute DriftCompensation */ -class ReadGroupKeyManagementMaxGroupKeysPerFabric : public ReadAttribute { +class ReadColorControlDriftCompensation : public ReadAttribute { public: - ReadGroupKeyManagementMaxGroupKeysPerFabric() - : ReadAttribute("max-group-keys-per-fabric") - { - } + ReadColorControlDriftCompensation() : ReadAttribute("drift-compensation") {} + + ~ReadColorControlDriftCompensation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDriftCompensationWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.DriftCompensation response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl DriftCompensation read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlDriftCompensation + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlDriftCompensation() + : SubscribeAttribute("drift-compensation") {} + + ~SubscribeAttributeColorControlDriftCompensation() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDriftCompensationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.DriftCompensation response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadGroupKeyManagementMaxGroupKeysPerFabric() {} +/* + * Attribute CompensationText + */ +class ReadColorControlCompensationText : public ReadAttribute { +public: + ReadColorControlCompensationText() : ReadAttribute("compensation-text") {} + + ~ReadColorControlCompensationText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCompensationTextWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CompensationText response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl CompensationText read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlCompensationText + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlCompensationText() + : SubscribeAttribute("compensation-text") {} + + ~SubscribeAttributeColorControlCompensationText() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCompensationTextWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CompensationText response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x00000003) on endpoint %u", endpointId); +/* + * Attribute ColorTemperatureMireds + */ +class ReadColorControlColorTemperatureMireds : public ReadAttribute { +public: + ReadColorControlColorTemperatureMireds() + : ReadAttribute("color-temperature-mireds") {} + + ~ReadColorControlColorTemperatureMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorTemperatureMiredsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTemperatureMireds response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorTemperatureMireds read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorTemperatureMireds + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorTemperatureMireds() + : SubscribeAttribute("color-temperature-mireds") {} + + ~SubscribeAttributeColorControlColorTemperatureMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorTemperatureMiredsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTemperatureMireds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxGroupKeysPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement MaxGroupKeysPerFabric read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ColorMode + */ +class ReadColorControlColorMode : public ReadAttribute { +public: + ReadColorControlColorMode() : ReadAttribute("color-mode") {} + + ~ReadColorControlColorMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorModeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.ColorMode response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric : public SubscribeAttribute { +class SubscribeAttributeColorControlColorMode : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() - : SubscribeAttribute("max-group-keys-per-fabric") - { - } + SubscribeAttributeColorControlColorMode() + : SubscribeAttribute("color-mode") {} - ~SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() {} + ~SubscribeAttributeColorControlColorMode() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMaxGroupKeysPerFabricWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorMode response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute Options */ -class ReadGroupKeyManagementGeneratedCommandList : public ReadAttribute { +class ReadColorControlOptions : public ReadAttribute { public: - ReadGroupKeyManagementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadGroupKeyManagementGeneratedCommandList() {} + ReadColorControlOptions() : ReadAttribute("options") {} + + ~ReadColorControlOptions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOptionsWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Options response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Options read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteColorControlOptions : public WriteAttribute { +public: + WriteColorControlOptions() : WriteAttribute("options") { + AddArgument("attr-name", "options"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlOptions() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOptionsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl Options write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeGroupKeyManagementGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlOptions : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeColorControlOptions() : SubscribeAttribute("options") {} - ~SubscribeAttributeGroupKeyManagementGeneratedCommandList() {} + ~SubscribeAttributeColorControlOptions() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOptionsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Options response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute NumberOfPrimaries */ -class ReadGroupKeyManagementAcceptedCommandList : public ReadAttribute { +class ReadColorControlNumberOfPrimaries : public ReadAttribute { public: - ReadGroupKeyManagementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadGroupKeyManagementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); + ReadColorControlNumberOfPrimaries() : ReadAttribute("number-of-primaries") {} + + ~ReadColorControlNumberOfPrimaries() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNumberOfPrimariesWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl NumberOfPrimaries read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlNumberOfPrimaries + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlNumberOfPrimaries() + : SubscribeAttribute("number-of-primaries") {} + + ~SubscribeAttributeColorControlNumberOfPrimaries() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNumberOfPrimariesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.NumberOfPrimaries response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Primary1X + */ +class ReadColorControlPrimary1X : public ReadAttribute { +public: + ReadColorControlPrimary1X() : ReadAttribute("primary1x") {} + + ~ReadColorControlPrimary1X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary1XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary1X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary1X : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeColorControlPrimary1X() : SubscribeAttribute("primary1x") {} - ~SubscribeAttributeGroupKeyManagementAcceptedCommandList() {} + ~SubscribeAttributeColorControlPrimary1X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary1XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute Primary1Y */ -class ReadGroupKeyManagementAttributeList : public ReadAttribute { +class ReadColorControlPrimary1Y : public ReadAttribute { public: - ReadGroupKeyManagementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadGroupKeyManagementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary1Y() : ReadAttribute("primary1y") {} + + ~ReadColorControlPrimary1Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary1YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary1Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementAttributeList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary1Y : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeColorControlPrimary1Y() : SubscribeAttribute("primary1y") {} - ~SubscribeAttributeGroupKeyManagementAttributeList() {} + ~SubscribeAttributeColorControlPrimary1Y() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary1YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute Primary1Intensity */ -class ReadGroupKeyManagementFeatureMap : public ReadAttribute { +class ReadColorControlPrimary1Intensity : public ReadAttribute { public: - ReadGroupKeyManagementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadGroupKeyManagementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + ReadColorControlPrimary1Intensity() : ReadAttribute("primary1intensity") {} + + ~ReadColorControlPrimary1Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary1IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary1Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary1Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary1Intensity() + : SubscribeAttribute("primary1intensity") {} + + ~SubscribeAttributeColorControlPrimary1Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary1IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary1Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Primary2X + */ +class ReadColorControlPrimary2X : public ReadAttribute { +public: + ReadColorControlPrimary2X() : ReadAttribute("primary2x") {} + + ~ReadColorControlPrimary2X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary2XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary2X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeGroupKeyManagementFeatureMap : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary2X : public SubscribeAttribute { public: - SubscribeAttributeGroupKeyManagementFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeColorControlPrimary2X() : SubscribeAttribute("primary2x") {} - ~SubscribeAttributeGroupKeyManagementFeatureMap() {} + ~SubscribeAttributeColorControlPrimary2X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary2XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute Primary2Y */ -class ReadGroupKeyManagementClusterRevision : public ReadAttribute { +class ReadColorControlPrimary2Y : public ReadAttribute { public: - ReadGroupKeyManagementClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadColorControlPrimary2Y() : ReadAttribute("primary2y") {} + + ~ReadColorControlPrimary2Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary2YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary2Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadGroupKeyManagementClusterRevision() {} +class SubscribeAttributeColorControlPrimary2Y : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary2Y() : SubscribeAttribute("primary2y") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + ~SubscribeAttributeColorControlPrimary2Y() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("GroupKeyManagement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeGroupKeyManagementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeGroupKeyManagementClusterRevision() - : SubscribeAttribute("cluster-revision") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary2YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - ~SubscribeAttributeGroupKeyManagementClusterRevision() {} + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000003F) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"GroupKeyManagement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute Primary2Intensity + */ +class ReadColorControlPrimary2Intensity : public ReadAttribute { +public: + ReadColorControlPrimary2Intensity() : ReadAttribute("primary2intensity") {} + + ~ReadColorControlPrimary2Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary2IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary2Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary2Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary2Intensity() + : SubscribeAttribute("primary2intensity") {} + + ~SubscribeAttributeColorControlPrimary2Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary2IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary2Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster FixedLabel | 0x0040 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * LabelList | 0x0000 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Attribute LabelList + * Attribute Primary3X */ -class ReadFixedLabelLabelList : public ReadAttribute { +class ReadColorControlPrimary3X : public ReadAttribute { public: - ReadFixedLabelLabelList() - : ReadAttribute("label-list") - { - } - - ~ReadFixedLabelLabelList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLabelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.LabelList response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel LabelList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary3X() : ReadAttribute("primary3x") {} + + ~ReadColorControlPrimary3X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary3XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary3X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelLabelList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary3X : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelLabelList() - : SubscribeAttribute("label-list") - { - } + SubscribeAttributeColorControlPrimary3X() : SubscribeAttribute("primary3x") {} - ~SubscribeAttributeFixedLabelLabelList() {} + ~SubscribeAttributeColorControlPrimary3X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary3XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLabelListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.LabelList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute Primary3Y */ -class ReadFixedLabelGeneratedCommandList : public ReadAttribute { +class ReadColorControlPrimary3Y : public ReadAttribute { public: - ReadFixedLabelGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadFixedLabelGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary3Y() : ReadAttribute("primary3y") {} + + ~ReadColorControlPrimary3Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary3YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary3Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary3Y : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeColorControlPrimary3Y() : SubscribeAttribute("primary3y") {} - ~SubscribeAttributeFixedLabelGeneratedCommandList() {} + ~SubscribeAttributeColorControlPrimary3Y() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary3YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute Primary3Intensity */ -class ReadFixedLabelAcceptedCommandList : public ReadAttribute { +class ReadColorControlPrimary3Intensity : public ReadAttribute { public: - ReadFixedLabelAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadFixedLabelAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); + ReadColorControlPrimary3Intensity() : ReadAttribute("primary3intensity") {} + + ~ReadColorControlPrimary3Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary3IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary3Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary3Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary3Intensity() + : SubscribeAttribute("primary3intensity") {} + + ~SubscribeAttributeColorControlPrimary3Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary3IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary3Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Primary4X + */ +class ReadColorControlPrimary4X : public ReadAttribute { +public: + ReadColorControlPrimary4X() : ReadAttribute("primary4x") {} + + ~ReadColorControlPrimary4X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary4XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary4X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary4X : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeColorControlPrimary4X() : SubscribeAttribute("primary4x") {} - ~SubscribeAttributeFixedLabelAcceptedCommandList() {} + ~SubscribeAttributeColorControlPrimary4X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary4XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute Primary4Y */ -class ReadFixedLabelAttributeList : public ReadAttribute { +class ReadColorControlPrimary4Y : public ReadAttribute { public: - ReadFixedLabelAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadFixedLabelAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary4Y() : ReadAttribute("primary4y") {} + + ~ReadColorControlPrimary4Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary4YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary4Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelAttributeList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary4Y : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeColorControlPrimary4Y() : SubscribeAttribute("primary4y") {} - ~SubscribeAttributeFixedLabelAttributeList() {} + ~SubscribeAttributeColorControlPrimary4Y() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary4YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute Primary4Intensity */ -class ReadFixedLabelFeatureMap : public ReadAttribute { +class ReadColorControlPrimary4Intensity : public ReadAttribute { public: - ReadFixedLabelFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadFixedLabelFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + ReadColorControlPrimary4Intensity() : ReadAttribute("primary4intensity") {} + + ~ReadColorControlPrimary4Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary4IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary4Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary4Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary4Intensity() + : SubscribeAttribute("primary4intensity") {} + + ~SubscribeAttributeColorControlPrimary4Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary4IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary4Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Primary5X + */ +class ReadColorControlPrimary5X : public ReadAttribute { +public: + ReadColorControlPrimary5X() : ReadAttribute("primary5x") {} + + ~ReadColorControlPrimary5X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary5XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary5X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelFeatureMap : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary5X : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeColorControlPrimary5X() : SubscribeAttribute("primary5x") {} - ~SubscribeAttributeFixedLabelFeatureMap() {} + ~SubscribeAttributeColorControlPrimary5X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary5XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute Primary5Y */ -class ReadFixedLabelClusterRevision : public ReadAttribute { +class ReadColorControlPrimary5Y : public ReadAttribute { public: - ReadFixedLabelClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadFixedLabelClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("FixedLabel ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary5Y() : ReadAttribute("primary5y") {} + + ~ReadColorControlPrimary5Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary5YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary5Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeFixedLabelClusterRevision : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary5Y : public SubscribeAttribute { public: - SubscribeAttributeFixedLabelClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeColorControlPrimary5Y() : SubscribeAttribute("primary5y") {} - ~SubscribeAttributeFixedLabelClusterRevision() {} + ~SubscribeAttributeColorControlPrimary5Y() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000040) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary5YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster UserLabel | 0x0041 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * LabelList | 0x0000 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Attribute LabelList + * Attribute Primary5Intensity */ -class ReadUserLabelLabelList : public ReadAttribute { +class ReadColorControlPrimary5Intensity : public ReadAttribute { public: - ReadUserLabelLabelList() - : ReadAttribute("label-list") - { - } - - ~ReadUserLabelLabelList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLabelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.LabelList response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel LabelList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary5Intensity() : ReadAttribute("primary5intensity") {} + + ~ReadColorControlPrimary5Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000026) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary5IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary5Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary5Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary5Intensity() + : SubscribeAttribute("primary5intensity") {} + + ~SubscribeAttributeColorControlPrimary5Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary5IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary5Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteUserLabelLabelList : public WriteAttribute { +/* + * Attribute Primary6X + */ +class ReadColorControlPrimary6X : public ReadAttribute { public: - WriteUserLabelLabelList() - : WriteAttribute("label-list") - , mComplex(&mValue) - { - AddArgument("attr-name", "label-list"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUserLabelLabelList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRUserLabelClusterLabelStruct * newElement_0; - newElement_0 = [MTRUserLabelClusterLabelStruct new]; - newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() - length:entry_0.label.size() - encoding:NSUTF8StringEncoding]; - newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() - length:entry_0.value.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeLabelListWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UserLabel LabelList write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + ReadColorControlPrimary6X() : ReadAttribute("primary6x") {} + + ~ReadColorControlPrimary6X() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000028) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary6XWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6X response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary6X read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeUserLabelLabelList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary6X : public SubscribeAttribute { public: - SubscribeAttributeUserLabelLabelList() - : SubscribeAttribute("label-list") - { - } + SubscribeAttributeColorControlPrimary6X() : SubscribeAttribute("primary6x") {} - ~SubscribeAttributeUserLabelLabelList() {} + ~SubscribeAttributeColorControlPrimary6X() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary6XWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLabelListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.LabelList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6X response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute Primary6Y */ -class ReadUserLabelGeneratedCommandList : public ReadAttribute { +class ReadColorControlPrimary6Y : public ReadAttribute { public: - ReadUserLabelGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadUserLabelGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlPrimary6Y() : ReadAttribute("primary6y") {} + + ~ReadColorControlPrimary6Y() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary6YWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6Y response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary6Y read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeUserLabelGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlPrimary6Y : public SubscribeAttribute { public: - SubscribeAttributeUserLabelGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeColorControlPrimary6Y() : SubscribeAttribute("primary6y") {} - ~SubscribeAttributeUserLabelGeneratedCommandList() {} + ~SubscribeAttributeColorControlPrimary6Y() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary6YWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6Y response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute Primary6Intensity */ -class ReadUserLabelAcceptedCommandList : public ReadAttribute { +class ReadColorControlPrimary6Intensity : public ReadAttribute { public: - ReadUserLabelAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } + ReadColorControlPrimary6Intensity() : ReadAttribute("primary6intensity") {} + + ~ReadColorControlPrimary6Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePrimary6IntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl Primary6Intensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlPrimary6Intensity + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlPrimary6Intensity() + : SubscribeAttribute("primary6intensity") {} + + ~SubscribeAttributeColorControlPrimary6Intensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePrimary6IntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.Primary6Intensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadUserLabelAcceptedCommandList() {} +/* + * Attribute WhitePointX + */ +class ReadColorControlWhitePointX : public ReadAttribute { +public: + ReadColorControlWhitePointX() : ReadAttribute("white-point-x") {} + + ~ReadColorControlWhitePointX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWhitePointXWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.WhitePointX response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl WhitePointX read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteColorControlWhitePointX : public WriteAttribute { +public: + WriteColorControlWhitePointX() : WriteAttribute("white-point-x") { + AddArgument("attr-name", "white-point-x"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlWhitePointX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeWhitePointXWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ColorControl WhitePointX write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeUserLabelAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlWhitePointX : public SubscribeAttribute { public: - SubscribeAttributeUserLabelAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeColorControlWhitePointX() + : SubscribeAttribute("white-point-x") {} - ~SubscribeAttributeUserLabelAcceptedCommandList() {} + ~SubscribeAttributeColorControlWhitePointX() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWhitePointXWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.WhitePointX response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute WhitePointY */ -class ReadUserLabelAttributeList : public ReadAttribute { +class ReadColorControlWhitePointY : public ReadAttribute { public: - ReadUserLabelAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadUserLabelAttributeList() {} + ReadColorControlWhitePointY() : ReadAttribute("white-point-y") {} + + ~ReadColorControlWhitePointY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWhitePointYWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.WhitePointY response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl WhitePointY read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteColorControlWhitePointY : public WriteAttribute { +public: + WriteColorControlWhitePointY() : WriteAttribute("white-point-y") { + AddArgument("attr-name", "white-point-y"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlWhitePointY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeWhitePointYWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ColorControl WhitePointY write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeUserLabelAttributeList : public SubscribeAttribute { +class SubscribeAttributeColorControlWhitePointY : public SubscribeAttribute { public: - SubscribeAttributeUserLabelAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeColorControlWhitePointY() + : SubscribeAttribute("white-point-y") {} - ~SubscribeAttributeUserLabelAttributeList() {} + ~SubscribeAttributeColorControlWhitePointY() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWhitePointYWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.WhitePointY response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ColorPointRX */ -class ReadUserLabelFeatureMap : public ReadAttribute { +class ReadColorControlColorPointRX : public ReadAttribute { public: - ReadUserLabelFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadUserLabelFeatureMap() {} + ReadColorControlColorPointRX() : ReadAttribute("color-point-rx") {} + + ~ReadColorControlColorPointRX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointRXWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRX response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointRX read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +class WriteColorControlColorPointRX : public WriteAttribute { +public: + WriteColorControlColorPointRX() : WriteAttribute("color-point-rx") { + AddArgument("attr-name", "color-point-rx"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointRX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointRXWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointRX write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeUserLabelFeatureMap : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointRX : public SubscribeAttribute { public: - SubscribeAttributeUserLabelFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeColorControlColorPointRX() + : SubscribeAttribute("color-point-rx") {} - ~SubscribeAttributeUserLabelFeatureMap() {} + ~SubscribeAttributeColorControlColorPointRX() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointRXWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRX response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute ColorPointRY */ -class ReadUserLabelClusterRevision : public ReadAttribute { +class ReadColorControlColorPointRY : public ReadAttribute { public: - ReadUserLabelClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadUserLabelClusterRevision() {} + ReadColorControlColorPointRY() : ReadAttribute("color-point-ry") {} + + ~ReadColorControlColorPointRY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000033) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointRYWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRY response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointRY read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +class WriteColorControlColorPointRY : public WriteAttribute { +public: + WriteColorControlColorPointRY() : WriteAttribute("color-point-ry") { + AddArgument("attr-name", "color-point-ry"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointRY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointRYWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointRY write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("UserLabel ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeUserLabelClusterRevision : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointRY : public SubscribeAttribute { public: - SubscribeAttributeUserLabelClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeColorControlColorPointRY() + : SubscribeAttribute("color-point-ry") {} - ~SubscribeAttributeUserLabelClusterRevision() {} + ~SubscribeAttributeColorControlColorPointRY() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000041) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointRYWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UserLabel.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRY response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster BooleanState | 0x0045 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * StateValue | 0x0000 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * StateChange | 0x0000 | -\*----------------------------------------------------------------------------*/ - /* - * Attribute StateValue + * Attribute ColorPointRIntensity */ -class ReadBooleanStateStateValue : public ReadAttribute { +class ReadColorControlColorPointRIntensity : public ReadAttribute { public: - ReadBooleanStateStateValue() - : ReadAttribute("state-value") - { - } - - ~ReadBooleanStateStateValue() {} + ReadColorControlColorPointRIntensity() + : ReadAttribute("color-point-rintensity") {} + + ~ReadColorControlColorPointRIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000034) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointRIntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRIntensity response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointRIntensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x00000000) on endpoint %u", endpointId); +class WriteColorControlColorPointRIntensity : public WriteAttribute { +public: + WriteColorControlColorPointRIntensity() + : WriteAttribute("color-point-rintensity") { + AddArgument("attr-name", "color-point-rintensity"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointRIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeColorPointRIntensityWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointRIntens" + "ity write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStateValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.StateValue response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState StateValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBooleanStateStateValue : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointRIntensity + : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateStateValue() - : SubscribeAttribute("state-value") - { - } + SubscribeAttributeColorControlColorPointRIntensity() + : SubscribeAttribute("color-point-rintensity") {} - ~SubscribeAttributeBooleanStateStateValue() {} + ~SubscribeAttributeColorControlColorPointRIntensity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointRIntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeStateValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.StateValue response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointRIntensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute ColorPointGX */ -class ReadBooleanStateGeneratedCommandList : public ReadAttribute { +class ReadColorControlColorPointGX : public ReadAttribute { public: - ReadBooleanStateGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBooleanStateGeneratedCommandList() {} + ReadColorControlColorPointGX() : ReadAttribute("color-point-gx") {} + + ~ReadColorControlColorPointGX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000036) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointGXWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGX response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointGX read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteColorControlColorPointGX : public WriteAttribute { +public: + WriteColorControlColorPointGX() : WriteAttribute("color-point-gx") { + AddArgument("attr-name", "color-point-gx"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointGX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000036) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointGXWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointGX write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeBooleanStateGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointGX : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeColorControlColorPointGX() + : SubscribeAttribute("color-point-gx") {} - ~SubscribeAttributeBooleanStateGeneratedCommandList() {} + ~SubscribeAttributeColorControlColorPointGX() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000036) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointGXWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGX response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute ColorPointGY */ -class ReadBooleanStateAcceptedCommandList : public ReadAttribute { +class ReadColorControlColorPointGY : public ReadAttribute { public: - ReadBooleanStateAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBooleanStateAcceptedCommandList() {} + ReadColorControlColorPointGY() : ReadAttribute("color-point-gy") {} + + ~ReadColorControlColorPointGY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000037) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointGYWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGY response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointGY read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteColorControlColorPointGY : public WriteAttribute { +public: + WriteColorControlColorPointGY() : WriteAttribute("color-point-gy") { + AddArgument("attr-name", "color-point-gy"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointGY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000037) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointGYWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointGY write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeBooleanStateAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointGY : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeColorControlColorPointGY() + : SubscribeAttribute("color-point-gy") {} - ~SubscribeAttributeBooleanStateAcceptedCommandList() {} + ~SubscribeAttributeColorControlColorPointGY() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000037) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointGYWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGY response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute ColorPointGIntensity */ -class ReadBooleanStateAttributeList : public ReadAttribute { +class ReadColorControlColorPointGIntensity : public ReadAttribute { public: - ReadBooleanStateAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadBooleanStateAttributeList() {} + ReadColorControlColorPointGIntensity() + : ReadAttribute("color-point-gintensity") {} + + ~ReadColorControlColorPointGIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00000038) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointGIntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGIntensity response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointGIntensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteColorControlColorPointGIntensity : public WriteAttribute { +public: + WriteColorControlColorPointGIntensity() + : WriteAttribute("color-point-gintensity") { + AddArgument("attr-name", "color-point-gintensity"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointGIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00000038) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeColorPointGIntensityWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointGIntens" + "ity write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeBooleanStateAttributeList : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointGIntensity + : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeColorControlColorPointGIntensity() + : SubscribeAttribute("color-point-gintensity") {} - ~SubscribeAttributeBooleanStateAttributeList() {} + ~SubscribeAttributeColorControlColorPointGIntensity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00000038) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointGIntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointGIntensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute ColorPointBX */ -class ReadBooleanStateFeatureMap : public ReadAttribute { +class ReadColorControlColorPointBX : public ReadAttribute { public: - ReadBooleanStateFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadBooleanStateFeatureMap() {} + ReadColorControlColorPointBX() : ReadAttribute("color-point-bx") {} + + ~ReadColorControlColorPointBX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointBXWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBX response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointBX read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +class WriteColorControlColorPointBX : public WriteAttribute { +public: + WriteColorControlColorPointBX() : WriteAttribute("color-point-bx") { + AddArgument("attr-name", "color-point-bx"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointBX() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointBXWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointBX write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeBooleanStateFeatureMap : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointBX : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeColorControlColorPointBX() + : SubscribeAttribute("color-point-bx") {} - ~SubscribeAttributeBooleanStateFeatureMap() {} + ~SubscribeAttributeColorControlColorPointBX() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000003A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointBXWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBX response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute ColorPointBY */ -class ReadBooleanStateClusterRevision : public ReadAttribute { +class ReadColorControlColorPointBY : public ReadAttribute { public: - ReadBooleanStateClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadBooleanStateClusterRevision() {} + ReadColorControlColorPointBY() : ReadAttribute("color-point-by") {} + + ~ReadColorControlColorPointBY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000003B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointBYWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBY response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointBY read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +class WriteColorControlColorPointBY : public WriteAttribute { +public: + WriteColorControlColorPointBY() : WriteAttribute("color-point-by") { + AddArgument("attr-name", "color-point-by"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointBY() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x0000003B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeColorPointBYWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointBY write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BooleanState ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeBooleanStateClusterRevision : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointBY : public SubscribeAttribute { public: - SubscribeAttributeBooleanStateClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeColorControlColorPointBY() + : SubscribeAttribute("color-point-by") {} - ~SubscribeAttributeBooleanStateClusterRevision() {} + ~SubscribeAttributeColorControlColorPointBY() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000045) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000003B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointBYWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BooleanState.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBY response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster ModeSelect | 0x0050 | -|------------------------------------------------------------------------------| -| Commands: | | -| * ChangeToMode | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * Description | 0x0000 | -| * StandardNamespace | 0x0001 | -| * SupportedModes | 0x0002 | -| * CurrentMode | 0x0003 | -| * StartUpMode | 0x0004 | -| * OnMode | 0x0005 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - /* - * Command ChangeToMode + * Attribute ColorPointBIntensity */ -class ModeSelectChangeToMode : public ClusterCommand { +class ReadColorControlColorPointBIntensity : public ReadAttribute { public: - ModeSelectChangeToMode() - : ClusterCommand("change-to-mode") - { - AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRModeSelectClusterChangeToModeParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster changeToModeWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type mRequest; + ReadColorControlColorPointBIntensity() + : ReadAttribute("color-point-bintensity") {} + + ~ReadColorControlColorPointBIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000003C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorPointBIntensityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBIntensity response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorPointBIntensity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Attribute Description - */ -class ReadModeSelectDescription : public ReadAttribute { +class WriteColorControlColorPointBIntensity : public WriteAttribute { public: - ReadModeSelectDescription() - : ReadAttribute("description") - { - } - - ~ReadModeSelectDescription() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000000) on endpoint %u", endpointId); + WriteColorControlColorPointBIntensity() + : WriteAttribute("color-point-bintensity") { + AddArgument("attr-name", "color-point-bintensity"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlColorPointBIntensity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x0000003C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeColorPointBIntensityWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ColorControl " + "ColorPointBIntens" + "ity write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.Description response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect Description read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeModeSelectDescription : public SubscribeAttribute { +class SubscribeAttributeColorControlColorPointBIntensity + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectDescription() - : SubscribeAttribute("description") - { - } + SubscribeAttributeColorControlColorPointBIntensity() + : SubscribeAttribute("color-point-bintensity") {} - ~SubscribeAttributeModeSelectDescription() {} + ~SubscribeAttributeColorControlColorPointBIntensity() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000003C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorPointBIntensityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDescriptionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.Description response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorPointBIntensity response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute StandardNamespace + * Attribute EnhancedCurrentHue */ -class ReadModeSelectStandardNamespace : public ReadAttribute { +class ReadColorControlEnhancedCurrentHue : public ReadAttribute { public: - ReadModeSelectStandardNamespace() - : ReadAttribute("standard-namespace") - { - } - - ~ReadModeSelectStandardNamespace() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStandardNamespaceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect StandardNamespace read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlEnhancedCurrentHue() + : ReadAttribute("enhanced-current-hue") {} + + ~ReadColorControlEnhancedCurrentHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnhancedCurrentHueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.EnhancedCurrentHue response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl EnhancedCurrentHue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlEnhancedCurrentHue + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlEnhancedCurrentHue() + : SubscribeAttribute("enhanced-current-hue") {} + + ~SubscribeAttributeColorControlEnhancedCurrentHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnhancedCurrentHueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.EnhancedCurrentHue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeModeSelectStandardNamespace : public SubscribeAttribute { +/* + * Attribute EnhancedColorMode + */ +class ReadColorControlEnhancedColorMode : public ReadAttribute { public: - SubscribeAttributeModeSelectStandardNamespace() - : SubscribeAttribute("standard-namespace") - { - } - - ~SubscribeAttributeModeSelectStandardNamespace() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStandardNamespaceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadColorControlEnhancedColorMode() : ReadAttribute("enhanced-color-mode") {} + + ~ReadColorControlEnhancedColorMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnhancedColorModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl EnhancedColorMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlEnhancedColorMode + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlEnhancedColorMode() + : SubscribeAttribute("enhanced-color-mode") {} + + ~SubscribeAttributeColorControlEnhancedColorMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnhancedColorModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.EnhancedColorMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute SupportedModes + * Attribute ColorLoopActive */ -class ReadModeSelectSupportedModes : public ReadAttribute { +class ReadColorControlColorLoopActive : public ReadAttribute { public: - ReadModeSelectSupportedModes() - : ReadAttribute("supported-modes") - { - } - - ~ReadModeSelectSupportedModes() {} + ReadColorControlColorLoopActive() : ReadAttribute("color-loop-active") {} + + ~ReadColorControlColorLoopActive() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorLoopActiveWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorLoopActive read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorLoopActive + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorLoopActive() + : SubscribeAttribute("color-loop-active") {} + + ~SubscribeAttributeColorControlColorLoopActive() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorLoopActiveWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopActive response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000002) on endpoint %u", endpointId); +/* + * Attribute ColorLoopDirection + */ +class ReadColorControlColorLoopDirection : public ReadAttribute { +public: + ReadColorControlColorLoopDirection() + : ReadAttribute("color-loop-direction") {} + + ~ReadColorControlColorLoopDirection() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorLoopDirectionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopDirection response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorLoopDirection read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorLoopDirection + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorLoopDirection() + : SubscribeAttribute("color-loop-direction") {} + + ~SubscribeAttributeColorControlColorLoopDirection() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorLoopDirectionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopDirection response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.SupportedModes response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect SupportedModes read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ColorLoopTime + */ +class ReadColorControlColorLoopTime : public ReadAttribute { +public: + ReadColorControlColorLoopTime() : ReadAttribute("color-loop-time") {} + + ~ReadColorControlColorLoopTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorLoopTimeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorLoopTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeModeSelectSupportedModes : public SubscribeAttribute { +class SubscribeAttributeColorControlColorLoopTime : public SubscribeAttribute { public: - SubscribeAttributeModeSelectSupportedModes() - : SubscribeAttribute("supported-modes") - { - } + SubscribeAttributeColorControlColorLoopTime() + : SubscribeAttribute("color-loop-time") {} - ~SubscribeAttributeModeSelectSupportedModes() {} + ~SubscribeAttributeColorControlColorLoopTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorLoopTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeSupportedModesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.SupportedModes response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentMode + * Attribute ColorLoopStartEnhancedHue */ -class ReadModeSelectCurrentMode : public ReadAttribute { +class ReadColorControlColorLoopStartEnhancedHue : public ReadAttribute { public: - ReadModeSelectCurrentMode() - : ReadAttribute("current-mode") - { - } - - ~ReadModeSelectCurrentMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.CurrentMode response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect CurrentMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadColorControlColorLoopStartEnhancedHue() + : ReadAttribute("color-loop-start-enhanced-hue") {} + + ~ReadColorControlColorLoopStartEnhancedHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorLoopStartEnhancedHue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorLoopStartEnhancedHue + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorLoopStartEnhancedHue() + : SubscribeAttribute("color-loop-start-enhanced-hue") {} + + ~SubscribeAttributeColorControlColorLoopStartEnhancedHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorLoopStartEnhancedHueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeModeSelectCurrentMode : public SubscribeAttribute { +/* + * Attribute ColorLoopStoredEnhancedHue + */ +class ReadColorControlColorLoopStoredEnhancedHue : public ReadAttribute { public: - SubscribeAttributeModeSelectCurrentMode() - : SubscribeAttribute("current-mode") - { - } - - ~SubscribeAttributeModeSelectCurrentMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.CurrentMode response %@", [value description]); - SetCommandExitStatus(error); - }]; + ReadColorControlColorLoopStoredEnhancedHue() + : ReadAttribute("color-loop-stored-enhanced-hue") {} + + ~ReadColorControlColorLoopStoredEnhancedHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorLoopStoredEnhancedHue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorLoopStoredEnhancedHue + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorLoopStoredEnhancedHue() + : SubscribeAttribute("color-loop-stored-enhanced-hue") {} + + ~SubscribeAttributeColorControlColorLoopStoredEnhancedHue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorLoopStoredEnhancedHueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ColorCapabilities + */ +class ReadColorControlColorCapabilities : public ReadAttribute { +public: + ReadColorControlColorCapabilities() : ReadAttribute("color-capabilities") {} + + ~ReadColorControlColorCapabilities() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000400A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorCapabilitiesWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ColorCapabilities read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorCapabilities + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorCapabilities() + : SubscribeAttribute("color-capabilities") {} + + ~SubscribeAttributeColorControlColorCapabilities() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000400A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorCapabilitiesWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorCapabilities response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute StartUpMode + * Attribute ColorTempPhysicalMinMireds */ -class ReadModeSelectStartUpMode : public ReadAttribute { +class ReadColorControlColorTempPhysicalMinMireds : public ReadAttribute { public: - ReadModeSelectStartUpMode() - : ReadAttribute("start-up-mode") - { - } + ReadColorControlColorTempPhysicalMinMireds() + : ReadAttribute("color-temp-physical-min-mireds") {} + + ~ReadColorControlColorTempPhysicalMinMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000400B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorTempPhysicalMinMiredsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorTempPhysicalMinMireds read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorTempPhysicalMinMireds + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorTempPhysicalMinMireds() + : SubscribeAttribute("color-temp-physical-min-mireds") {} + + ~SubscribeAttributeColorControlColorTempPhysicalMinMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000400B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorTempPhysicalMinMiredsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadModeSelectStartUpMode() {} +/* + * Attribute ColorTempPhysicalMaxMireds + */ +class ReadColorControlColorTempPhysicalMaxMireds : public ReadAttribute { +public: + ReadColorControlColorTempPhysicalMaxMireds() + : ReadAttribute("color-temp-physical-max-mireds") {} + + ~ReadColorControlColorTempPhysicalMaxMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000400C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeColorTempPhysicalMaxMiredsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl ColorTempPhysicalMaxMireds read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlColorTempPhysicalMaxMireds + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlColorTempPhysicalMaxMireds() + : SubscribeAttribute("color-temp-physical-max-mireds") {} + + ~SubscribeAttributeColorControlColorTempPhysicalMaxMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000400C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeColorTempPhysicalMaxMiredsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000004) on endpoint %u", endpointId); +/* + * Attribute CoupleColorTempToLevelMinMireds + */ +class ReadColorControlCoupleColorTempToLevelMinMireds : public ReadAttribute { +public: + ReadColorControlCoupleColorTempToLevelMinMireds() + : ReadAttribute("couple-color-temp-to-level-min-mireds") {} + + ~ReadColorControlCoupleColorTempToLevelMinMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000400D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCoupleColorTempToLevelMinMiredsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl CoupleColorTempToLevelMinMireds read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() + : SubscribeAttribute("couple-color-temp-to-level-min-mireds") {} + + ~SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000400D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCoupleColorTempToLevelMinMiredsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.StartUpMode response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect StartUpMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute StartUpColorTemperatureMireds + */ +class ReadColorControlStartUpColorTemperatureMireds : public ReadAttribute { +public: + ReadColorControlStartUpColorTemperatureMireds() + : ReadAttribute("start-up-color-temperature-mireds") {} + + ~ReadColorControlStartUpColorTemperatureMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x00004010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartUpColorTemperatureMiredsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl StartUpColorTemperatureMireds read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteModeSelectStartUpMode : public WriteAttribute { +class WriteColorControlStartUpColorTemperatureMireds : public WriteAttribute { public: - WriteModeSelectStartUpMode() - : WriteAttribute("start-up-mode") - { - AddArgument("attr-name", "start-up-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteModeSelectStartUpMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeStartUpModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ModeSelect StartUpMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteColorControlStartUpColorTemperatureMireds() + : WriteAttribute("start-up-color-temperature-mireds") { + AddArgument("attr-name", "start-up-color-temperature-mireds"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteColorControlStartUpColorTemperatureMireds() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) WriteAttribute (0x00004010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeStartUpColorTemperatureMiredsWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "ColorControl " + "StartUpColorTemperat" + "ureMireds write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint16_t mValue; }; -class SubscribeAttributeModeSelectStartUpMode : public SubscribeAttribute { +class SubscribeAttributeColorControlStartUpColorTemperatureMireds + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectStartUpMode() - : SubscribeAttribute("start-up-mode") - { - } + SubscribeAttributeColorControlStartUpColorTemperatureMireds() + : SubscribeAttribute("start-up-color-temperature-mireds") {} - ~SubscribeAttributeModeSelectStartUpMode() {} + ~SubscribeAttributeColorControlStartUpColorTemperatureMireds() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x00004010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartUpColorTemperatureMiredsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeStartUpModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.StartUpMode response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute OnMode + * Attribute GeneratedCommandList */ -class ReadModeSelectOnMode : public ReadAttribute { +class ReadColorControlGeneratedCommandList : public ReadAttribute { public: - ReadModeSelectOnMode() - : ReadAttribute("on-mode") - { - } + ReadColorControlGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadColorControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeColorControlGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AcceptedCommandList + */ +class ReadColorControlAcceptedCommandList : public ReadAttribute { +public: + ReadColorControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadColorControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ColorControl AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeColorControlAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AttributeList + */ +class ReadColorControlAttributeList : public ReadAttribute { +public: + ReadColorControlAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadColorControlAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadModeSelectOnMode() {} +class SubscribeAttributeColorControlAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeColorControlAttributeList() + : SubscribeAttribute("attribute-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000005) on endpoint %u", endpointId); + ~SubscribeAttributeColorControlAttributeList() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.OnMode response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect OnMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteModeSelectOnMode : public WriteAttribute { +/* + * Attribute FeatureMap + */ +class ReadColorControlFeatureMap : public ReadAttribute { public: - WriteModeSelectOnMode() - : WriteAttribute("on-mode") - { - AddArgument("attr-name", "on-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteModeSelectOnMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOnModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ModeSelect OnMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + ReadColorControlFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadColorControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ColorControl.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeColorControlFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeColorControlFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - uint8_t mValue; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeModeSelectOnMode : public SubscribeAttribute { +/* + * Attribute ClusterRevision + */ +class ReadColorControlClusterRevision : public ReadAttribute { public: - SubscribeAttributeModeSelectOnMode() - : SubscribeAttribute("on-mode") - { - } + ReadColorControlClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadColorControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("ColorControl ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeColorControlClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeColorControlClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeColorControlClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000300) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterColorControl alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ColorControl.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeModeSelectOnMode() {} +/*----------------------------------------------------------------------------*\ +| Cluster BallastConfiguration | 0x0301 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * PhysicalMinLevel | 0x0000 | +| * PhysicalMaxLevel | 0x0001 | +| * BallastStatus | 0x0002 | +| * MinLevel | 0x0010 | +| * MaxLevel | 0x0011 | +| * IntrinsicBalanceFactor | 0x0014 | +| * BallastFactorAdjustment | 0x0015 | +| * LampQuantity | 0x0020 | +| * LampType | 0x0030 | +| * LampManufacturer | 0x0031 | +| * LampRatedHours | 0x0032 | +| * LampBurnHours | 0x0033 | +| * LampAlarmMode | 0x0034 | +| * LampBurnHoursTripPoint | 0x0035 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOnModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.OnMode response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute PhysicalMinLevel + */ +class ReadBallastConfigurationPhysicalMinLevel : public ReadAttribute { +public: + ReadBallastConfigurationPhysicalMinLevel() + : ReadAttribute("physical-min-level") {} + + ~ReadBallastConfigurationPhysicalMinLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePhysicalMinLevelWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration PhysicalMinLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationPhysicalMinLevel + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationPhysicalMinLevel() + : SubscribeAttribute("physical-min-level") {} + + ~SubscribeAttributeBallastConfigurationPhysicalMinLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePhysicalMinLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute PhysicalMaxLevel + */ +class ReadBallastConfigurationPhysicalMaxLevel : public ReadAttribute { +public: + ReadBallastConfigurationPhysicalMaxLevel() + : ReadAttribute("physical-max-level") {} + + ~ReadBallastConfigurationPhysicalMaxLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePhysicalMaxLevelWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration PhysicalMaxLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationPhysicalMaxLevel + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationPhysicalMaxLevel() + : SubscribeAttribute("physical-max-level") {} + + ~SubscribeAttributeBallastConfigurationPhysicalMaxLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePhysicalMaxLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute GeneratedCommandList + * Attribute BallastStatus */ -class ReadModeSelectGeneratedCommandList : public ReadAttribute { +class ReadBallastConfigurationBallastStatus : public ReadAttribute { public: - ReadModeSelectGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } + ReadBallastConfigurationBallastStatus() : ReadAttribute("ballast-status") {} + + ~ReadBallastConfigurationBallastStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBallastStatusWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.BallastStatus response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration BallastStatus read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationBallastStatus + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationBallastStatus() + : SubscribeAttribute("ballast-status") {} + + ~SubscribeAttributeBallastConfigurationBallastStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBallastStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.BallastStatus response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadModeSelectGeneratedCommandList() {} +/* + * Attribute MinLevel + */ +class ReadBallastConfigurationMinLevel : public ReadAttribute { +public: + ReadBallastConfigurationMinLevel() : ReadAttribute("min-level") {} + + ~ReadBallastConfigurationMinLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinLevelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BallastConfiguration.MinLevel response %@", [value description]); + if (error != nil) { + LogNSError("BallastConfiguration MinLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); +class WriteBallastConfigurationMinLevel : public WriteAttribute { +public: + WriteBallastConfigurationMinLevel() : WriteAttribute("min-level") { + AddArgument("attr-name", "min-level"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationMinLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeMinLevelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "MinLevel write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeModeSelectGeneratedCommandList : public SubscribeAttribute { +class SubscribeAttributeBallastConfigurationMinLevel + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } + SubscribeAttributeBallastConfigurationMinLevel() + : SubscribeAttribute("min-level") {} - ~SubscribeAttributeModeSelectGeneratedCommandList() {} + ~SubscribeAttributeBallastConfigurationMinLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.MinLevel response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcceptedCommandList + * Attribute MaxLevel */ -class ReadModeSelectAcceptedCommandList : public ReadAttribute { +class ReadBallastConfigurationMaxLevel : public ReadAttribute { public: - ReadModeSelectAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadModeSelectAcceptedCommandList() {} + ReadBallastConfigurationMaxLevel() : ReadAttribute("max-level") {} + + ~ReadBallastConfigurationMaxLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxLevelWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BallastConfiguration.MaxLevel response %@", [value description]); + if (error != nil) { + LogNSError("BallastConfiguration MaxLevel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); +class WriteBallastConfigurationMaxLevel : public WriteAttribute { +public: + WriteBallastConfigurationMaxLevel() : WriteAttribute("max-level") { + AddArgument("attr-name", "max-level"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationMaxLevel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeMaxLevelWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "MaxLevel write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeModeSelectAcceptedCommandList : public SubscribeAttribute { +class SubscribeAttributeBallastConfigurationMaxLevel + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } + SubscribeAttributeBallastConfigurationMaxLevel() + : SubscribeAttribute("max-level") {} - ~SubscribeAttributeModeSelectAcceptedCommandList() {} + ~SubscribeAttributeBallastConfigurationMaxLevel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxLevelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.MaxLevel response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AttributeList + * Attribute IntrinsicBalanceFactor */ -class ReadModeSelectAttributeList : public ReadAttribute { +class ReadBallastConfigurationIntrinsicBalanceFactor : public ReadAttribute { public: - ReadModeSelectAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadModeSelectAttributeList() {} + ReadBallastConfigurationIntrinsicBalanceFactor() + : ReadAttribute("intrinsic-balance-factor") {} + + ~ReadBallastConfigurationIntrinsicBalanceFactor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeIntrinsicBalanceFactorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.IntrinsicBalanceFactor response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration IntrinsicBalanceFactor read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); +class WriteBallastConfigurationIntrinsicBalanceFactor : public WriteAttribute { +public: + WriteBallastConfigurationIntrinsicBalanceFactor() + : WriteAttribute("intrinsic-balance-factor") { + AddArgument("attr-name", "intrinsic-balance-factor"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationIntrinsicBalanceFactor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeIntrinsicBalanceFactorWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration" + " IntrinsicBalanceFac" + "tor write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeModeSelectAttributeList : public SubscribeAttribute { +class SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor() + : SubscribeAttribute("intrinsic-balance-factor") {} - ~SubscribeAttributeModeSelectAttributeList() {} + ~SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeIntrinsicBalanceFactorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.IntrinsicBalanceFactor response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute FeatureMap + * Attribute BallastFactorAdjustment */ -class ReadModeSelectFeatureMap : public ReadAttribute { +class ReadBallastConfigurationBallastFactorAdjustment : public ReadAttribute { public: - ReadModeSelectFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadModeSelectFeatureMap() {} + ReadBallastConfigurationBallastFactorAdjustment() + : ReadAttribute("ballast-factor-adjustment") {} + + ~ReadBallastConfigurationBallastFactorAdjustment() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBallastFactorAdjustmentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration BallastFactorAdjustment read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); +class WriteBallastConfigurationBallastFactorAdjustment : public WriteAttribute { +public: + WriteBallastConfigurationBallastFactorAdjustment() + : WriteAttribute("ballast-factor-adjustment") { + AddArgument("attr-name", "ballast-factor-adjustment"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationBallastFactorAdjustment() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeBallastFactorAdjustmentWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BallastConfiguration " + "BallastFactorAdjustme" + "nt write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeModeSelectFeatureMap : public SubscribeAttribute { +class SubscribeAttributeBallastConfigurationBallastFactorAdjustment + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeBallastConfigurationBallastFactorAdjustment() + : SubscribeAttribute("ballast-factor-adjustment") {} - ~SubscribeAttributeModeSelectFeatureMap() {} + ~SubscribeAttributeBallastConfigurationBallastFactorAdjustment() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBallastFactorAdjustmentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ClusterRevision + * Attribute LampQuantity */ -class ReadModeSelectClusterRevision : public ReadAttribute { +class ReadBallastConfigurationLampQuantity : public ReadAttribute { public: - ReadModeSelectClusterRevision() - : ReadAttribute("cluster-revision") - { - } + ReadBallastConfigurationLampQuantity() : ReadAttribute("lamp-quantity") {} + + ~ReadBallastConfigurationLampQuantity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampQuantityWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampQuantity response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampQuantity read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationLampQuantity + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationLampQuantity() + : SubscribeAttribute("lamp-quantity") {} + + ~SubscribeAttributeBallastConfigurationLampQuantity() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLampQuantityWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampQuantity response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadModeSelectClusterRevision() {} +/* + * Attribute LampType + */ +class ReadBallastConfigurationLampType : public ReadAttribute { +public: + ReadBallastConfigurationLampType() : ReadAttribute("lamp-type") {} + + ~ReadBallastConfigurationLampType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampTypeWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampType response %@", [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); +class WriteBallastConfigurationLampType : public WriteAttribute { +public: + WriteBallastConfigurationLampType() : WriteAttribute("lamp-type") { + AddArgument("attr-name", "lamp-type"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster writeAttributeLampTypeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "LampType write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ModeSelect ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::ByteSpan mValue; }; -class SubscribeAttributeModeSelectClusterRevision : public SubscribeAttribute { +class SubscribeAttributeBallastConfigurationLampType + : public SubscribeAttribute { public: - SubscribeAttributeModeSelectClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeBallastConfigurationLampType() + : SubscribeAttribute("lamp-type") {} - ~SubscribeAttributeModeSelectClusterRevision() {} + ~SubscribeAttributeBallastConfigurationLampType() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLampTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampType response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; -/*----------------------------------------------------------------------------*\ -| Cluster DoorLock | 0x0101 | -|------------------------------------------------------------------------------| -| Commands: | | -| * LockDoor | 0x00 | -| * UnlockDoor | 0x01 | -| * UnlockWithTimeout | 0x03 | -| * SetWeekDaySchedule | 0x0B | -| * GetWeekDaySchedule | 0x0C | -| * ClearWeekDaySchedule | 0x0D | -| * SetYearDaySchedule | 0x0E | -| * GetYearDaySchedule | 0x0F | -| * ClearYearDaySchedule | 0x10 | -| * SetHolidaySchedule | 0x11 | -| * GetHolidaySchedule | 0x12 | -| * ClearHolidaySchedule | 0x13 | -| * SetUser | 0x1A | -| * GetUser | 0x1B | -| * ClearUser | 0x1D | -| * SetCredential | 0x22 | -| * GetCredentialStatus | 0x24 | -| * ClearCredential | 0x26 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * LockState | 0x0000 | -| * LockType | 0x0001 | -| * ActuatorEnabled | 0x0002 | -| * DoorState | 0x0003 | -| * DoorOpenEvents | 0x0004 | -| * DoorClosedEvents | 0x0005 | -| * OpenPeriod | 0x0006 | -| * NumberOfTotalUsersSupported | 0x0011 | -| * NumberOfPINUsersSupported | 0x0012 | -| * NumberOfRFIDUsersSupported | 0x0013 | -| * NumberOfWeekDaySchedulesSupportedPerUser | 0x0014 | -| * NumberOfYearDaySchedulesSupportedPerUser | 0x0015 | -| * NumberOfHolidaySchedulesSupported | 0x0016 | -| * MaxPINCodeLength | 0x0017 | -| * MinPINCodeLength | 0x0018 | -| * MaxRFIDCodeLength | 0x0019 | -| * MinRFIDCodeLength | 0x001A | -| * CredentialRulesSupport | 0x001B | -| * NumberOfCredentialsSupportedPerUser | 0x001C | -| * Language | 0x0021 | -| * LEDSettings | 0x0022 | -| * AutoRelockTime | 0x0023 | -| * SoundVolume | 0x0024 | -| * OperatingMode | 0x0025 | -| * SupportedOperatingModes | 0x0026 | -| * DefaultConfigurationRegister | 0x0027 | -| * EnableLocalProgramming | 0x0028 | -| * EnableOneTouchLocking | 0x0029 | -| * EnableInsideStatusLED | 0x002A | -| * EnablePrivacyModeButton | 0x002B | -| * LocalProgrammingFeatures | 0x002C | -| * WrongCodeEntryLimit | 0x0030 | -| * UserCodeTemporaryDisableTime | 0x0031 | -| * SendPINOverTheAir | 0x0032 | -| * RequirePINforRemoteOperation | 0x0033 | -| * ExpiringUserTimeout | 0x0035 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * DoorLockAlarm | 0x0000 | -| * DoorStateChange | 0x0001 | -| * LockOperation | 0x0002 | -| * LockOperationError | 0x0003 | -| * LockUserChange | 0x0004 | -\*----------------------------------------------------------------------------*/ - /* - * Command LockDoor + * Attribute LampManufacturer */ -class DoorLockLockDoor : public ClusterCommand { +class ReadBallastConfigurationLampManufacturer : public ReadAttribute { public: - DoorLockLockDoor() - : ClusterCommand("lock-door") - { - AddArgument("PinCode", &mRequest.pinCode); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000000) on endpoint %u", endpointId); + ReadBallastConfigurationLampManufacturer() + : ReadAttribute("lamp-manufacturer") {} + + ~ReadBallastConfigurationLampManufacturer() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampManufacturerWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampManufacturer response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampManufacturer read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.pinCode.HasValue()) { - params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() length:mRequest.pinCode.Value().size()]; - } else { - params.pinCode = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } +class WriteBallastConfigurationLampManufacturer : public WriteAttribute { +public: + WriteBallastConfigurationLampManufacturer() + : WriteAttribute("lamp-manufacturer") { + AddArgument("attr-name", "lamp-manufacturer"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampManufacturer() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeLampManufacturerWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "BallastConfiguration " + "LampManufacturer write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DoorLock::Commands::LockDoor::Type mRequest; + chip::ByteSpan mValue; }; -/* - * Command UnlockDoor - */ -class DoorLockUnlockDoor : public ClusterCommand { +class SubscribeAttributeBallastConfigurationLampManufacturer + : public SubscribeAttribute { public: - DoorLockUnlockDoor() - : ClusterCommand("unlock-door") - { - AddArgument("PinCode", &mRequest.pinCode); - ClusterCommand::AddArguments(); - } + SubscribeAttributeBallastConfigurationLampManufacturer() + : SubscribeAttribute("lamp-manufacturer") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000001) on endpoint %u", endpointId); + ~SubscribeAttributeBallastConfigurationLampManufacturer() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.pinCode.HasValue()) { - params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() length:mRequest.pinCode.Value().size()]; - } else { - params.pinCode = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeLampManufacturerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampManufacturer response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command UnlockWithTimeout + * Attribute LampRatedHours */ -class DoorLockUnlockWithTimeout : public ClusterCommand { +class ReadBallastConfigurationLampRatedHours : public ReadAttribute { public: - DoorLockUnlockWithTimeout() - : ClusterCommand("unlock-with-timeout") - { - AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); - AddArgument("PinCode", &mRequest.pinCode); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.timeout = [NSNumber numberWithUnsignedShort:mRequest.timeout]; - if (mRequest.pinCode.HasValue()) { - params.pinCode = [NSData dataWithBytes:mRequest.pinCode.Value().data() length:mRequest.pinCode.Value().size()]; - } else { - params.pinCode = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster unlockWithTimeoutWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type mRequest; + ReadBallastConfigurationLampRatedHours() + : ReadAttribute("lamp-rated-hours") {} + + ~ReadBallastConfigurationLampRatedHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampRatedHoursWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampRatedHours response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampRatedHours read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -/* - * Command SetWeekDaySchedule - */ -class DoorLockSetWeekDaySchedule : public ClusterCommand { +class WriteBallastConfigurationLampRatedHours : public WriteAttribute { public: - DoorLockSetWeekDaySchedule() - : ClusterCommand("set-week-day-schedule") - { - AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - AddArgument("DaysMask", 0, UINT8_MAX, &mRequest.daysMask); - AddArgument("StartHour", 0, UINT8_MAX, &mRequest.startHour); - AddArgument("StartMinute", 0, UINT8_MAX, &mRequest.startMinute); - AddArgument("EndHour", 0, UINT8_MAX, &mRequest.endHour); - AddArgument("EndMinute", 0, UINT8_MAX, &mRequest.endMinute); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - params.daysMask = [NSNumber numberWithUnsignedChar:mRequest.daysMask.Raw()]; - params.startHour = [NSNumber numberWithUnsignedChar:mRequest.startHour]; - params.startMinute = [NSNumber numberWithUnsignedChar:mRequest.startMinute]; - params.endHour = [NSNumber numberWithUnsignedChar:mRequest.endHour]; - params.endMinute = [NSNumber numberWithUnsignedChar:mRequest.endMinute]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setWeekDayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + WriteBallastConfigurationLampRatedHours() + : WriteAttribute("lamp-rated-hours") { + AddArgument("attr-name", "lamp-rated-hours"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampRatedHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeLampRatedHoursWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "LampRatedHours write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type mRequest; + uint32_t mValue; }; -/* - * Command GetWeekDaySchedule - */ -class DoorLockGetWeekDaySchedule : public ClusterCommand { +class SubscribeAttributeBallastConfigurationLampRatedHours + : public SubscribeAttribute { public: - DoorLockGetWeekDaySchedule() - : ClusterCommand("get-week-day-schedule") - { - AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getWeekDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBallastConfigurationLampRatedHours() + : SubscribeAttribute("lamp-rated-hours") {} + + ~SubscribeAttributeBallastConfigurationLampRatedHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLampRatedHoursWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampRatedHours response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command ClearWeekDaySchedule + * Attribute LampBurnHours */ -class DoorLockClearWeekDaySchedule : public ClusterCommand { +class ReadBallastConfigurationLampBurnHours : public ReadAttribute { public: - DoorLockClearWeekDaySchedule() - : ClusterCommand("clear-week-day-schedule") - { - AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterClearWeekDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearWeekDayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + ReadBallastConfigurationLampBurnHours() : ReadAttribute("lamp-burn-hours") {} + + ~ReadBallastConfigurationLampBurnHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000033) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampBurnHoursWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampBurnHours response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampBurnHours read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteBallastConfigurationLampBurnHours : public WriteAttribute { +public: + WriteBallastConfigurationLampBurnHours() : WriteAttribute("lamp-burn-hours") { + AddArgument("attr-name", "lamp-burn-hours"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampBurnHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeLampBurnHoursWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "LampBurnHours write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type mRequest; + uint32_t mValue; }; -/* - * Command SetYearDaySchedule - */ -class DoorLockSetYearDaySchedule : public ClusterCommand { +class SubscribeAttributeBallastConfigurationLampBurnHours + : public SubscribeAttribute { public: - DoorLockSetYearDaySchedule() - : ClusterCommand("set-year-day-schedule") - { - AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); - AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - params.localStartTime = [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; - params.localEndTime = [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setYearDayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBallastConfigurationLampBurnHours() + : SubscribeAttribute("lamp-burn-hours") {} + + ~SubscribeAttributeBallastConfigurationLampBurnHours() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000033) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLampBurnHoursWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampBurnHours response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command GetYearDaySchedule + * Attribute LampAlarmMode */ -class DoorLockGetYearDaySchedule : public ClusterCommand { +class ReadBallastConfigurationLampAlarmMode : public ReadAttribute { public: - DoorLockGetYearDaySchedule() - : ClusterCommand("get-year-day-schedule") - { - AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + ReadBallastConfigurationLampAlarmMode() : ReadAttribute("lamp-alarm-mode") {} + + ~ReadBallastConfigurationLampAlarmMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000034) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampAlarmModeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampAlarmMode response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampAlarmMode read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteBallastConfigurationLampAlarmMode : public WriteAttribute { +public: + WriteBallastConfigurationLampAlarmMode() : WriteAttribute("lamp-alarm-mode") { + AddArgument("attr-name", "lamp-alarm-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampAlarmMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeLampAlarmModeWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration " + "LampAlarmMode write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type mRequest; + uint8_t mValue; }; -/* - * Command ClearYearDaySchedule - */ -class DoorLockClearYearDaySchedule : public ClusterCommand { +class SubscribeAttributeBallastConfigurationLampAlarmMode + : public SubscribeAttribute { public: - DoorLockClearYearDaySchedule() - : ClusterCommand("clear-year-day-schedule") - { - AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearYearDayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBallastConfigurationLampAlarmMode() + : SubscribeAttribute("lamp-alarm-mode") {} + + ~SubscribeAttributeBallastConfigurationLampAlarmMode() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000034) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeLampAlarmModeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampAlarmMode response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command SetHolidaySchedule + * Attribute LampBurnHoursTripPoint */ -class DoorLockSetHolidaySchedule : public ClusterCommand { +class ReadBallastConfigurationLampBurnHoursTripPoint : public ReadAttribute { public: - DoorLockSetHolidaySchedule() - : ClusterCommand("set-holiday-schedule") - { - AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); - AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); - AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); - AddArgument("OperatingMode", 0, UINT8_MAX, &mRequest.operatingMode); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; - params.localStartTime = [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; - params.localEndTime = [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; - params.operatingMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operatingMode)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setHolidayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + ReadBallastConfigurationLampBurnHoursTripPoint() + : ReadAttribute("lamp-burn-hours-trip-point") {} + + ~ReadBallastConfigurationLampBurnHoursTripPoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x00000035) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLampBurnHoursTripPointWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration LampBurnHoursTripPoint read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteBallastConfigurationLampBurnHoursTripPoint : public WriteAttribute { +public: + WriteBallastConfigurationLampBurnHoursTripPoint() + : WriteAttribute("lamp-burn-hours-trip-point") { + AddArgument("attr-name", "lamp-burn-hours-trip-point"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteBallastConfigurationLampBurnHoursTripPoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) WriteAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeLampBurnHoursTripPointWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("BallastConfiguration" + " LampBurnHoursTripPo" + "int write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type mRequest; + uint32_t mValue; }; -/* - * Command GetHolidaySchedule - */ -class DoorLockGetHolidaySchedule : public ClusterCommand { +class SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint + : public SubscribeAttribute { public: - DoorLockGetHolidaySchedule() - : ClusterCommand("get-holiday-schedule") - { - AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getHolidayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() + : SubscribeAttribute("lamp-burn-hours-trip-point") {} + + ~SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x00000035) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLampBurnHoursTripPointWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", + [value description]); + SetCommandExitStatus(error); + }]; -private: - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Command ClearHolidaySchedule + * Attribute GeneratedCommandList */ -class DoorLockClearHolidaySchedule : public ClusterCommand { +class ReadBallastConfigurationGeneratedCommandList : public ReadAttribute { public: - DoorLockClearHolidaySchedule() - : ClusterCommand("clear-holiday-schedule") - { - AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterClearHolidayScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearHolidayScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type mRequest; + ReadBallastConfigurationGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadBallastConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeBallastConfigurationGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command SetUser + * Attribute AcceptedCommandList */ -class DoorLockSetUser : public ClusterCommand { +class ReadBallastConfigurationAcceptedCommandList : public ReadAttribute { public: - DoorLockSetUser() - : ClusterCommand("set-user") - { - AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - AddArgument("UserName", &mRequest.userName); - AddArgument("UserUniqueId", 0, UINT32_MAX, &mRequest.userUniqueId); - AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); - AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); - AddArgument("CredentialRule", 0, UINT8_MAX, &mRequest.credentialRule); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.operationType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - if (mRequest.userName.IsNull()) { - params.userName = nil; - } else { - params.userName = [[NSString alloc] initWithBytes:mRequest.userName.Value().data() - length:mRequest.userName.Value().size() - encoding:NSUTF8StringEncoding]; - } - if (mRequest.userUniqueId.IsNull()) { - params.userUniqueId = nil; - } else { - params.userUniqueId = [NSNumber numberWithUnsignedInt:mRequest.userUniqueId.Value()]; - } - if (mRequest.userStatus.IsNull()) { - params.userStatus = nil; - } else { - params.userStatus = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userStatus.Value())]; - } - if (mRequest.userType.IsNull()) { - params.userType = nil; - } else { - params.userType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userType.Value())]; - } - if (mRequest.credentialRule.IsNull()) { - params.credentialRule = nil; - } else { - params.credentialRule = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credentialRule.Value())]; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setUserWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::SetUser::Type mRequest; + ReadBallastConfigurationAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadBallastConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeBallastConfigurationAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command GetUser + * Attribute AttributeList */ -class DoorLockGetUser : public ClusterCommand { +class ReadBallastConfigurationAttributeList : public ReadAttribute { public: - DoorLockGetUser() - : ClusterCommand("get-user") - { - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::GetUser::Type mRequest; + ReadBallastConfigurationAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadBallastConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeBallastConfigurationAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command ClearUser + * Attribute FeatureMap */ -class DoorLockClearUser : public ClusterCommand { +class ReadBallastConfigurationFeatureMap : public ReadAttribute { public: - DoorLockClearUser() - : ClusterCommand("clear-user") - { - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000001D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::ClearUser::Type mRequest; + ReadBallastConfigurationFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadBallastConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"BallastConfiguration.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeBallastConfigurationFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command SetCredential + * Attribute ClusterRevision */ -class DoorLockSetCredential : public ClusterCommand { +class ReadBallastConfigurationClusterRevision : public ReadAttribute { public: - DoorLockSetCredential() - : ClusterCommand("set-credential") - , mComplex_Credential(&mRequest.credential) - { - AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); - AddArgument("Credential", &mComplex_Credential); - AddArgument("CredentialData", &mRequest.credentialData); - AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); - AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); - AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000022) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.operationType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; - params.credential = [MTRDoorLockClusterDlCredential new]; - params.credential.credentialType = - [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.credentialType)]; - params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; - params.credentialData = [NSData dataWithBytes:mRequest.credentialData.data() length:mRequest.credentialData.size()]; - if (mRequest.userIndex.IsNull()) { - params.userIndex = nil; - } else { - params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex.Value()]; - } - if (mRequest.userStatus.IsNull()) { - params.userStatus = nil; - } else { - params.userStatus = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userStatus.Value())]; - } - if (mRequest.userType.IsNull()) { - params.userType = nil; - } else { - params.userType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userType.Value())]; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setCredentialWithParams:params - completion:^( - MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::SetCredential::Type mRequest; - TypedComplexArgument mComplex_Credential; + ReadBallastConfigurationClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadBallastConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("BallastConfiguration ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBallastConfigurationClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeBallastConfigurationClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeBallastConfigurationClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000301) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterBallastConfiguration alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"BallastConfiguration.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster IlluminanceMeasurement | 0x0400 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * Tolerance | 0x0003 | +| * LightSensorType | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Command GetCredentialStatus + * Attribute MeasuredValue */ -class DoorLockGetCredentialStatus : public ClusterCommand { +class ReadIlluminanceMeasurementMeasuredValue : public ReadAttribute { public: - DoorLockGetCredentialStatus() - : ClusterCommand("get-credential-status") - , mComplex_Credential(&mRequest.credential) - { - AddArgument("Credential", &mComplex_Credential); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.credential = [MTRDoorLockClusterDlCredential new]; - params.credential.credentialType = - [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.credentialType)]; - params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type mRequest; - TypedComplexArgument mComplex_Credential; + ReadIlluminanceMeasurementMeasuredValue() : ReadAttribute("measured-value") {} + + ~ReadIlluminanceMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement MeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementMeasuredValue() + : SubscribeAttribute("measured-value") {} + + ~SubscribeAttributeIlluminanceMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Command ClearCredential + * Attribute MinMeasuredValue */ -class DoorLockClearCredential : public ClusterCommand { +class ReadIlluminanceMeasurementMinMeasuredValue : public ReadAttribute { public: - DoorLockClearCredential() - : ClusterCommand("clear-credential") - , mComplex_Credential(&mRequest.credential) - { - AddArgument("Credential", &mComplex_Credential); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.credential.IsNull()) { - params.credential = nil; - } else { - params.credential = [MTRDoorLockClusterDlCredential new]; - params.credential.credentialType = - [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.Value().credentialType)]; - params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.Value().credentialIndex]; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type mRequest; - TypedComplexArgument> - mComplex_Credential; + ReadIlluminanceMeasurementMinMeasuredValue() + : ReadAttribute("min-measured-value") {} + + ~ReadIlluminanceMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement MinMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementMinMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() + : SubscribeAttribute("min-measured-value") {} + + ~SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LockState + * Attribute MaxMeasuredValue */ -class ReadDoorLockLockState : public ReadAttribute { +class ReadIlluminanceMeasurementMaxMeasuredValue : public ReadAttribute { public: - ReadDoorLockLockState() - : ReadAttribute("lock-state") - { - } - - ~ReadDoorLockLockState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LockState response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock LockState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementMaxMeasuredValue() + : ReadAttribute("max-measured-value") {} + + ~ReadIlluminanceMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement MaxMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() + : SubscribeAttribute("max-measured-value") {} + + ~SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockLockState : public SubscribeAttribute { +/* + * Attribute Tolerance + */ +class ReadIlluminanceMeasurementTolerance : public ReadAttribute { public: - SubscribeAttributeDoorLockLockState() - : SubscribeAttribute("lock-state") - { - } - - ~SubscribeAttributeDoorLockLockState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLockStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LockState response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementTolerance() : ReadAttribute("tolerance") {} + + ~ReadIlluminanceMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeToleranceWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.Tolerance response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement Tolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementTolerance + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementTolerance() + : SubscribeAttribute("tolerance") {} + + ~SubscribeAttributeIlluminanceMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.Tolerance response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LockType + * Attribute LightSensorType */ -class ReadDoorLockLockType : public ReadAttribute { +class ReadIlluminanceMeasurementLightSensorType : public ReadAttribute { public: - ReadDoorLockLockType() - : ReadAttribute("lock-type") - { - } - - ~ReadDoorLockLockType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLockTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LockType response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock LockType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementLightSensorType() + : ReadAttribute("light-sensor-type") {} + + ~ReadIlluminanceMeasurementLightSensorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLightSensorTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.LightSensorType response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement LightSensorType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementLightSensorType + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementLightSensorType() + : SubscribeAttribute("light-sensor-type") {} + + ~SubscribeAttributeIlluminanceMeasurementLightSensorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLightSensorTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.LightSensorType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockLockType : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockLockType() - : SubscribeAttribute("lock-type") - { - } - - ~SubscribeAttributeDoorLockLockType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLockTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LockType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute GeneratedCommandList + */ +class ReadIlluminanceMeasurementGeneratedCommandList : public ReadAttribute { +public: + ReadIlluminanceMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadIlluminanceMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActuatorEnabled + * Attribute AcceptedCommandList */ -class ReadDoorLockActuatorEnabled : public ReadAttribute { +class ReadIlluminanceMeasurementAcceptedCommandList : public ReadAttribute { public: - ReadDoorLockActuatorEnabled() - : ReadAttribute("actuator-enabled") - { - } - - ~ReadDoorLockActuatorEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeActuatorEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock ActuatorEnabled read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadIlluminanceMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockActuatorEnabled : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadIlluminanceMeasurementAttributeList : public ReadAttribute { public: - SubscribeAttributeDoorLockActuatorEnabled() - : SubscribeAttribute("actuator-enabled") - { - } - - ~SubscribeAttributeDoorLockActuatorEnabled() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActuatorEnabledWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadIlluminanceMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeIlluminanceMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute DoorState + * Attribute FeatureMap */ -class ReadDoorLockDoorState : public ReadAttribute { +class ReadIlluminanceMeasurementFeatureMap : public ReadAttribute { public: - ReadDoorLockDoorState() - : ReadAttribute("door-state") - { - } - - ~ReadDoorLockDoorState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDoorStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorState response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock DoorState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadIlluminanceMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadIlluminanceMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeIlluminanceMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockDoorState : public SubscribeAttribute { +/* + * Attribute ClusterRevision + */ +class ReadIlluminanceMeasurementClusterRevision : public ReadAttribute { public: - SubscribeAttributeDoorLockDoorState() - : SubscribeAttribute("door-state") - { - } - - ~SubscribeAttributeDoorLockDoorState() {} + ReadIlluminanceMeasurementClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadIlluminanceMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("IlluminanceMeasurement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIlluminanceMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeIlluminanceMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeIlluminanceMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000400) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDoorStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorState response %@", [value description]); - SetCommandExitStatus(error); - }]; +/*----------------------------------------------------------------------------*\ +| Cluster TemperatureMeasurement | 0x0402 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * Tolerance | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredValue + */ +class ReadTemperatureMeasurementMeasuredValue : public ReadAttribute { +public: + ReadTemperatureMeasurementMeasuredValue() : ReadAttribute("measured-value") {} + + ~ReadTemperatureMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement MeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementMeasuredValue() + : SubscribeAttribute("measured-value") {} + + ~SubscribeAttributeTemperatureMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute DoorOpenEvents + * Attribute MinMeasuredValue */ -class ReadDoorLockDoorOpenEvents : public ReadAttribute { +class ReadTemperatureMeasurementMinMeasuredValue : public ReadAttribute { public: - ReadDoorLockDoorOpenEvents() - : ReadAttribute("door-open-events") - { - } - - ~ReadDoorLockDoorOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDoorOpenEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock DoorOpenEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadTemperatureMeasurementMinMeasuredValue() + : ReadAttribute("min-measured-value") {} + + ~ReadTemperatureMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement MinMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementMinMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementMinMeasuredValue() + : SubscribeAttribute("min-measured-value") {} + + ~SubscribeAttributeTemperatureMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteDoorLockDoorOpenEvents : public WriteAttribute { +/* + * Attribute MaxMeasuredValue + */ +class ReadTemperatureMeasurementMaxMeasuredValue : public ReadAttribute { public: - WriteDoorLockDoorOpenEvents() - : WriteAttribute("door-open-events") - { - AddArgument("attr-name", "door-open-events"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } + ReadTemperatureMeasurementMaxMeasuredValue() + : ReadAttribute("max-measured-value") {} + + ~ReadTemperatureMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement MaxMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementMaxMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() + : SubscribeAttribute("max-measured-value") {} + + ~SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~WriteDoorLockDoorOpenEvents() {} +/* + * Attribute Tolerance + */ +class ReadTemperatureMeasurementTolerance : public ReadAttribute { +public: + ReadTemperatureMeasurementTolerance() : ReadAttribute("tolerance") {} + + ~ReadTemperatureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeToleranceWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.Tolerance response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement Tolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementTolerance + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementTolerance() + : SubscribeAttribute("tolerance") {} + + ~SubscribeAttributeTemperatureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.Tolerance response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; +/* + * Attribute GeneratedCommandList + */ +class ReadTemperatureMeasurementGeneratedCommandList : public ReadAttribute { +public: + ReadTemperatureMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadTemperatureMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeTemperatureMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - [cluster writeAttributeDoorOpenEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock DoorOpenEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadTemperatureMeasurementAcceptedCommandList : public ReadAttribute { +public: + ReadTemperatureMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadTemperatureMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeTemperatureMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; -private: - uint32_t mValue; +/* + * Attribute AttributeList + */ +class ReadTemperatureMeasurementAttributeList : public ReadAttribute { +public: + ReadTemperatureMeasurementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadTemperatureMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeTemperatureMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockDoorOpenEvents : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadTemperatureMeasurementFeatureMap : public ReadAttribute { public: - SubscribeAttributeDoorLockDoorOpenEvents() - : SubscribeAttribute("door-open-events") - { - } + ReadTemperatureMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadTemperatureMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeTemperatureMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeDoorLockDoorOpenEvents() {} +/* + * Attribute ClusterRevision + */ +class ReadTemperatureMeasurementClusterRevision : public ReadAttribute { +public: + ReadTemperatureMeasurementClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadTemperatureMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("TemperatureMeasurement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTemperatureMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeTemperatureMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeTemperatureMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000402) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterTemperatureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TemperatureMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDoorOpenEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; +/*----------------------------------------------------------------------------*\ +| Cluster PressureMeasurement | 0x0403 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * Tolerance | 0x0003 | +| * ScaledValue | 0x0010 | +| * MinScaledValue | 0x0011 | +| * MaxScaledValue | 0x0012 | +| * ScaledTolerance | 0x0013 | +| * Scale | 0x0014 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredValue + */ +class ReadPressureMeasurementMeasuredValue : public ReadAttribute { +public: + ReadPressureMeasurementMeasuredValue() : ReadAttribute("measured-value") {} + + ~ReadPressureMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement MeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMeasuredValue() + : SubscribeAttribute("measured-value") {} + + ~SubscribeAttributePressureMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute DoorClosedEvents + * Attribute MinMeasuredValue */ -class ReadDoorLockDoorClosedEvents : public ReadAttribute { +class ReadPressureMeasurementMinMeasuredValue : public ReadAttribute { public: - ReadDoorLockDoorClosedEvents() - : ReadAttribute("door-closed-events") - { - } - - ~ReadDoorLockDoorClosedEvents() {} + ReadPressureMeasurementMinMeasuredValue() + : ReadAttribute("min-measured-value") {} + + ~ReadPressureMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MinMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement MinMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementMinMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMinMeasuredValue() + : SubscribeAttribute("min-measured-value") {} + + ~SubscribeAttributePressureMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MinMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000005) on endpoint %u", endpointId); +/* + * Attribute MaxMeasuredValue + */ +class ReadPressureMeasurementMaxMeasuredValue : public ReadAttribute { +public: + ReadPressureMeasurementMaxMeasuredValue() + : ReadAttribute("max-measured-value") {} + + ~ReadPressureMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement MaxMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementMaxMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMaxMeasuredValue() + : SubscribeAttribute("max-measured-value") {} + + ~SubscribeAttributePressureMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDoorClosedEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock DoorClosedEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Tolerance + */ +class ReadPressureMeasurementTolerance : public ReadAttribute { +public: + ReadPressureMeasurementTolerance() : ReadAttribute("tolerance") {} + + ~ReadPressureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeToleranceWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); + if (error != nil) { + LogNSError("PressureMeasurement Tolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementTolerance + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementTolerance() + : SubscribeAttribute("tolerance") {} + + ~SubscribeAttributePressureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.Tolerance response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteDoorLockDoorClosedEvents : public WriteAttribute { +/* + * Attribute ScaledValue + */ +class ReadPressureMeasurementScaledValue : public ReadAttribute { public: - WriteDoorLockDoorClosedEvents() - : WriteAttribute("door-closed-events") - { - AddArgument("attr-name", "door-closed-events"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } + ReadPressureMeasurementScaledValue() : ReadAttribute("scaled-value") {} + + ~ReadPressureMeasurementScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeScaledValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ScaledValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement ScaledValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementScaledValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementScaledValue() + : SubscribeAttribute("scaled-value") {} + + ~SubscribeAttributePressureMeasurementScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeScaledValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ScaledValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~WriteDoorLockDoorClosedEvents() {} +/* + * Attribute MinScaledValue + */ +class ReadPressureMeasurementMinScaledValue : public ReadAttribute { +public: + ReadPressureMeasurementMinScaledValue() : ReadAttribute("min-scaled-value") {} + + ~ReadPressureMeasurementMinScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinScaledValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MinScaledValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement MinScaledValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementMinScaledValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMinScaledValue() + : SubscribeAttribute("min-scaled-value") {} + + ~SubscribeAttributePressureMeasurementMinScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinScaledValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MinScaledValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; +/* + * Attribute MaxScaledValue + */ +class ReadPressureMeasurementMaxScaledValue : public ReadAttribute { +public: + ReadPressureMeasurementMaxScaledValue() : ReadAttribute("max-scaled-value") {} + + ~ReadPressureMeasurementMaxScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxScaledValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MaxScaledValue response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement MaxScaledValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementMaxScaledValue + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMaxScaledValue() + : SubscribeAttribute("max-scaled-value") {} + + ~SubscribeAttributePressureMeasurementMaxScaledValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxScaledValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.MaxScaledValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - [cluster writeAttributeDoorClosedEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock DoorClosedEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ScaledTolerance + */ +class ReadPressureMeasurementScaledTolerance : public ReadAttribute { +public: + ReadPressureMeasurementScaledTolerance() + : ReadAttribute("scaled-tolerance") {} + + ~ReadPressureMeasurementScaledTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeScaledToleranceWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ScaledTolerance response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement ScaledTolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementScaledTolerance + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementScaledTolerance() + : SubscribeAttribute("scaled-tolerance") {} + + ~SubscribeAttributePressureMeasurementScaledTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeScaledToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ScaledTolerance response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; -private: - uint32_t mValue; +/* + * Attribute Scale + */ +class ReadPressureMeasurementScale : public ReadAttribute { +public: + ReadPressureMeasurementScale() : ReadAttribute("scale") {} + + ~ReadPressureMeasurementScale() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeScaleWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PressureMeasurement.Scale response %@", [value description]); + if (error != nil) { + LogNSError("PressureMeasurement Scale read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockDoorClosedEvents : public SubscribeAttribute { +class SubscribeAttributePressureMeasurementScale : public SubscribeAttribute { public: - SubscribeAttributeDoorLockDoorClosedEvents() - : SubscribeAttribute("door-closed-events") - { - } + SubscribeAttributePressureMeasurementScale() : SubscribeAttribute("scale") {} - ~SubscribeAttributeDoorLockDoorClosedEvents() {} + ~SubscribeAttributePressureMeasurementScale() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeScaleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDoorClosedEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.Scale response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute OpenPeriod + * Attribute GeneratedCommandList */ -class ReadDoorLockOpenPeriod : public ReadAttribute { +class ReadPressureMeasurementGeneratedCommandList : public ReadAttribute { public: - ReadDoorLockOpenPeriod() - : ReadAttribute("open-period") - { - } - - ~ReadDoorLockOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOpenPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.OpenPeriod response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock OpenPeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPressureMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadPressureMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributePressureMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteDoorLockOpenPeriod : public WriteAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadPressureMeasurementAcceptedCommandList : public ReadAttribute { public: - WriteDoorLockOpenPeriod() - : WriteAttribute("open-period") - { - AddArgument("attr-name", "open-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeOpenPeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock OpenPeriod write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; + ReadPressureMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadPressureMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributePressureMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockOpenPeriod : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadPressureMeasurementAttributeList : public ReadAttribute { public: - SubscribeAttributeDoorLockOpenPeriod() - : SubscribeAttribute("open-period") - { - } - - ~SubscribeAttributeDoorLockOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOpenPeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.OpenPeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadPressureMeasurementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadPressureMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributePressureMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfTotalUsersSupported + * Attribute FeatureMap */ -class ReadDoorLockNumberOfTotalUsersSupported : public ReadAttribute { +class ReadPressureMeasurementFeatureMap : public ReadAttribute { public: - ReadDoorLockNumberOfTotalUsersSupported() - : ReadAttribute("number-of-total-users-supported") - { - } - - ~ReadDoorLockNumberOfTotalUsersSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfTotalUsersSupported read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadPressureMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadPressureMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"PressureMeasurement.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("PressureMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributePressureMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfTotalUsersSupported : public SubscribeAttribute { +/* + * Attribute ClusterRevision + */ +class ReadPressureMeasurementClusterRevision : public ReadAttribute { public: - SubscribeAttributeDoorLockNumberOfTotalUsersSupported() - : SubscribeAttribute("number-of-total-users-supported") - { - } - - ~SubscribeAttributeDoorLockNumberOfTotalUsersSupported() {} + ReadPressureMeasurementClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadPressureMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("PressureMeasurement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributePressureMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributePressureMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000403) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterPressureMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"PressureMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfTotalUsersSupportedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", [value description]); - SetCommandExitStatus(error); - }]; +/*----------------------------------------------------------------------------*\ +| Cluster FlowMeasurement | 0x0404 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * Tolerance | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredValue + */ +class ReadFlowMeasurementMeasuredValue : public ReadAttribute { +public: + ReadFlowMeasurementMeasuredValue() : ReadAttribute("measured-value") {} + + ~ReadFlowMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); + if (error != nil) { + LogNSError("FlowMeasurement MeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementMeasuredValue() + : SubscribeAttribute("measured-value") {} + + ~SubscribeAttributeFlowMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfPINUsersSupported + * Attribute MinMeasuredValue */ -class ReadDoorLockNumberOfPINUsersSupported : public ReadAttribute { +class ReadFlowMeasurementMinMeasuredValue : public ReadAttribute { public: - ReadDoorLockNumberOfPINUsersSupported() - : ReadAttribute("number-of-pinusers-supported") - { - } - - ~ReadDoorLockNumberOfPINUsersSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfPINUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfPINUsersSupported read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFlowMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") {} + + ~ReadFlowMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MinMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("FlowMeasurement MinMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementMinMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementMinMeasuredValue() + : SubscribeAttribute("min-measured-value") {} + + ~SubscribeAttributeFlowMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MinMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfPINUsersSupported : public SubscribeAttribute { +/* + * Attribute MaxMeasuredValue + */ +class ReadFlowMeasurementMaxMeasuredValue : public ReadAttribute { public: - SubscribeAttributeDoorLockNumberOfPINUsersSupported() - : SubscribeAttribute("number-of-pinusers-supported") - { - } - - ~SubscribeAttributeDoorLockNumberOfPINUsersSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfPINUsersSupportedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadFlowMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") {} + + ~ReadFlowMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("FlowMeasurement MaxMeasuredValue read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementMaxMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementMaxMeasuredValue() + : SubscribeAttribute("max-measured-value") {} + + ~SubscribeAttributeFlowMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfRFIDUsersSupported + * Attribute Tolerance */ -class ReadDoorLockNumberOfRFIDUsersSupported : public ReadAttribute { +class ReadFlowMeasurementTolerance : public ReadAttribute { public: - ReadDoorLockNumberOfRFIDUsersSupported() - : ReadAttribute("number-of-rfidusers-supported") - { - } - - ~ReadDoorLockNumberOfRFIDUsersSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfRFIDUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfRFIDUsersSupported read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFlowMeasurementTolerance() : ReadAttribute("tolerance") {} + + ~ReadFlowMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeToleranceWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); + if (error != nil) { + LogNSError("FlowMeasurement Tolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfRFIDUsersSupported : public SubscribeAttribute { +class SubscribeAttributeFlowMeasurementTolerance : public SubscribeAttribute { public: - SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() - : SubscribeAttribute("number-of-rfidusers-supported") - { - } + SubscribeAttributeFlowMeasurementTolerance() + : SubscribeAttribute("tolerance") {} - ~SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() {} + ~SubscribeAttributeFlowMeasurementTolerance() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNumberOfRFIDUsersSupportedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfWeekDaySchedulesSupportedPerUser + * Attribute GeneratedCommandList */ -class ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser : public ReadAttribute { +class ReadFlowMeasurementGeneratedCommandList : public ReadAttribute { public: - ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() - : ReadAttribute("number-of-week-day-schedules-supported-per-user") - { - } - - ~ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfWeekDaySchedulesSupportedPerUser read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFlowMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadFlowMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("FlowMeasurement GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeFlowMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadFlowMeasurementAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() - : SubscribeAttribute("number-of-week-day-schedules-supported-per-user") - { - } - - ~SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadFlowMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadFlowMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("FlowMeasurement AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeFlowMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfYearDaySchedulesSupportedPerUser + * Attribute AttributeList */ -class ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser : public ReadAttribute { +class ReadFlowMeasurementAttributeList : public ReadAttribute { public: - ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() - : ReadAttribute("number-of-year-day-schedules-supported-per-user") - { - } - - ~ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000015) on endpoint %u", endpointId); + ReadFlowMeasurementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadFlowMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("FlowMeasurement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeFlowMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfYearDaySchedulesSupportedPerUser read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadFlowMeasurementFeatureMap : public ReadAttribute { +public: + ReadFlowMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadFlowMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("FlowMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser : public SubscribeAttribute { +class SubscribeAttributeFlowMeasurementFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() - : SubscribeAttribute("number-of-year-day-schedules-supported-per-user") - { - } + SubscribeAttributeFlowMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() {} + ~SubscribeAttributeFlowMeasurementFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute NumberOfHolidaySchedulesSupported + * Attribute ClusterRevision */ -class ReadDoorLockNumberOfHolidaySchedulesSupported : public ReadAttribute { +class ReadFlowMeasurementClusterRevision : public ReadAttribute { public: - ReadDoorLockNumberOfHolidaySchedulesSupported() - : ReadAttribute("number-of-holiday-schedules-supported") - { - } - - ~ReadDoorLockNumberOfHolidaySchedulesSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster - readAttributeNumberOfHolidaySchedulesSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfHolidaySchedulesSupported read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadFlowMeasurementClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadFlowMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("FlowMeasurement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFlowMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeFlowMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeFlowMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000404) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"FlowMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() - : SubscribeAttribute("number-of-holiday-schedules-supported") - { - } - - ~SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfHolidaySchedulesSupportedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", [value description]); - SetCommandExitStatus(error); - }]; +/*----------------------------------------------------------------------------*\ +| Cluster RelativeHumidityMeasurement | 0x0405 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * Tolerance | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredValue + */ +class ReadRelativeHumidityMeasurementMeasuredValue : public ReadAttribute { +public: + ReadRelativeHumidityMeasurementMeasuredValue() + : ReadAttribute("measured-value") {} + + ~ReadRelativeHumidityMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement MeasuredValue read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() + : SubscribeAttribute("measured-value") {} + + ~SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute MaxPINCodeLength + * Attribute MinMeasuredValue */ -class ReadDoorLockMaxPINCodeLength : public ReadAttribute { +class ReadRelativeHumidityMeasurementMinMeasuredValue : public ReadAttribute { public: - ReadDoorLockMaxPINCodeLength() - : ReadAttribute("max-pincode-length") - { - } - - ~ReadDoorLockMaxPINCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock MaxPINCodeLength read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementMinMeasuredValue() + : ReadAttribute("min-measured-value") {} + + ~ReadRelativeHumidityMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMinMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement MinMeasuredValue read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() + : SubscribeAttribute("min-measured-value") {} + + ~SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMinMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockMaxPINCodeLength : public SubscribeAttribute { +/* + * Attribute MaxMeasuredValue + */ +class ReadRelativeHumidityMeasurementMaxMeasuredValue : public ReadAttribute { public: - SubscribeAttributeDoorLockMaxPINCodeLength() - : SubscribeAttribute("max-pincode-length") - { - } - - ~SubscribeAttributeDoorLockMaxPINCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxPINCodeLengthWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementMaxMeasuredValue() + : ReadAttribute("max-measured-value") {} + + ~ReadRelativeHumidityMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMaxMeasuredValueWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement MaxMeasuredValue read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() + : SubscribeAttribute("max-measured-value") {} + + ~SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxMeasuredValueWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute MinPINCodeLength + * Attribute Tolerance */ -class ReadDoorLockMinPINCodeLength : public ReadAttribute { -public: - ReadDoorLockMinPINCodeLength() - : ReadAttribute("min-pincode-length") - { - } - - ~ReadDoorLockMinPINCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000018) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock MinPINCodeLength read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockMinPINCodeLength : public SubscribeAttribute { +class ReadRelativeHumidityMeasurementTolerance : public ReadAttribute { public: - SubscribeAttributeDoorLockMinPINCodeLength() - : SubscribeAttribute("min-pincode-length") - { - } - - ~SubscribeAttributeDoorLockMinPINCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinPINCodeLengthWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementTolerance() : ReadAttribute("tolerance") {} + + ~ReadRelativeHumidityMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeToleranceWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement Tolerance read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementTolerance + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementTolerance() + : SubscribeAttribute("tolerance") {} + + ~SubscribeAttributeRelativeHumidityMeasurementTolerance() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeToleranceWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute MaxRFIDCodeLength + * Attribute GeneratedCommandList */ -class ReadDoorLockMaxRFIDCodeLength : public ReadAttribute { -public: - ReadDoorLockMaxRFIDCodeLength() - : ReadAttribute("max-rfidcode-length") - { - } - - ~ReadDoorLockMaxRFIDCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock MaxRFIDCodeLength read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadRelativeHumidityMeasurementGeneratedCommandList + : public ReadAttribute { +public: + ReadRelativeHumidityMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadRelativeHumidityMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError( + "RelativeHumidityMeasurement GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockMaxRFIDCodeLength : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockMaxRFIDCodeLength() - : SubscribeAttribute("max-rfidcode-length") - { - } - - ~SubscribeAttributeDoorLockMaxRFIDCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxRFIDCodeLengthWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute AcceptedCommandList + */ +class ReadRelativeHumidityMeasurementAcceptedCommandList + : public ReadAttribute { +public: + ReadRelativeHumidityMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadRelativeHumidityMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute MinRFIDCodeLength + * Attribute AttributeList */ -class ReadDoorLockMinRFIDCodeLength : public ReadAttribute { +class ReadRelativeHumidityMeasurementAttributeList : public ReadAttribute { public: - ReadDoorLockMinRFIDCodeLength() - : ReadAttribute("min-rfidcode-length") - { - } - - ~ReadDoorLockMinRFIDCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock MinRFIDCodeLength read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementAttributeList() + : ReadAttribute("attribute-list") {} + + ~ReadRelativeHumidityMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement AttributeList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeRelativeHumidityMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockMinRFIDCodeLength : public SubscribeAttribute { +/* + * Attribute FeatureMap + */ +class ReadRelativeHumidityMeasurementFeatureMap : public ReadAttribute { public: - SubscribeAttributeDoorLockMinRFIDCodeLength() - : SubscribeAttribute("min-rfidcode-length") - { - } - - ~SubscribeAttributeDoorLockMinRFIDCodeLength() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinRFIDCodeLengthWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadRelativeHumidityMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeRelativeHumidityMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute CredentialRulesSupport + * Attribute ClusterRevision */ -class ReadDoorLockCredentialRulesSupport : public ReadAttribute { +class ReadRelativeHumidityMeasurementClusterRevision : public ReadAttribute { public: - ReadDoorLockCredentialRulesSupport() - : ReadAttribute("credential-rules-support") - { - } - - ~ReadDoorLockCredentialRulesSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeCredentialRulesSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.CredentialRulesSupport response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock CredentialRulesSupport read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadRelativeHumidityMeasurementClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadRelativeHumidityMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("RelativeHumidityMeasurement ClusterRevision read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRelativeHumidityMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeRelativeHumidityMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeRelativeHumidityMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000405) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockCredentialRulesSupport : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockCredentialRulesSupport() - : SubscribeAttribute("credential-rules-support") - { - } - - ~SubscribeAttributeDoorLockCredentialRulesSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCredentialRulesSupportWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.CredentialRulesSupport response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster OccupancySensing | 0x0406 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Occupancy | 0x0000 | +| * OccupancySensorType | 0x0001 | +| * OccupancySensorTypeBitmap | 0x0002 | +| * PirOccupiedToUnoccupiedDelay | 0x0010 | +| * PirUnoccupiedToOccupiedDelay | 0x0011 | +| * PirUnoccupiedToOccupiedThreshold | 0x0012 | +| * UltrasonicOccupiedToUnoccupiedDelay | 0x0020 | +| * UltrasonicUnoccupiedToOccupiedDelay | 0x0021 | +| * UltrasonicUnoccupiedToOccupiedThreshold | 0x0022 | +| * PhysicalContactOccupiedToUnoccupiedDelay | 0x0030 | +| * PhysicalContactUnoccupiedToOccupiedDelay | 0x0031 | +| * PhysicalContactUnoccupiedToOccupiedThreshold | 0x0032 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ /* - * Attribute NumberOfCredentialsSupportedPerUser + * Attribute Occupancy */ -class ReadDoorLockNumberOfCredentialsSupportedPerUser : public ReadAttribute { +class ReadOccupancySensingOccupancy : public ReadAttribute { public: - ReadDoorLockNumberOfCredentialsSupportedPerUser() - : ReadAttribute("number-of-credentials-supported-per-user") - { - } - - ~ReadDoorLockNumberOfCredentialsSupportedPerUser() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000001C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfCredentialsSupportedPerUserWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock NumberOfCredentialsSupportedPerUser read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadOccupancySensingOccupancy() : ReadAttribute("occupancy") {} + + ~ReadOccupancySensingOccupancy() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupancyWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OccupancySensing.Occupancy response %@", [value description]); + if (error != nil) { + LogNSError("OccupancySensing Occupancy read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingOccupancy : public SubscribeAttribute { public: - SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() - : SubscribeAttribute("number-of-credentials-supported-per-user") - { - } + SubscribeAttributeOccupancySensingOccupancy() + : SubscribeAttribute("occupancy") {} - ~SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() {} + ~SubscribeAttributeOccupancySensingOccupancy() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupancyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNumberOfCredentialsSupportedPerUserWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.Occupancy response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Language + * Attribute OccupancySensorType */ -class ReadDoorLockLanguage : public ReadAttribute { -public: - ReadDoorLockLanguage() - : ReadAttribute("language") - { - } - - ~ReadDoorLockLanguage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLanguageWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.Language response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock Language read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockLanguage : public WriteAttribute { +class ReadOccupancySensingOccupancySensorType : public ReadAttribute { public: - WriteDoorLockLanguage() - : WriteAttribute("language") - { - AddArgument("attr-name", "language"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockLanguage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeLanguageWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock Language write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::ByteSpan mValue; + ReadOccupancySensingOccupancySensorType() + : ReadAttribute("occupancy-sensor-type") {} + + ~ReadOccupancySensingOccupancySensorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupancySensorTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.OccupancySensorType response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing OccupancySensorType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingOccupancySensorType + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingOccupancySensorType() + : SubscribeAttribute("occupancy-sensor-type") {} + + ~SubscribeAttributeOccupancySensingOccupancySensorType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupancySensorTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.OccupancySensorType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeDoorLockLanguage : public SubscribeAttribute { +/* + * Attribute OccupancySensorTypeBitmap + */ +class ReadOccupancySensingOccupancySensorTypeBitmap : public ReadAttribute { public: - SubscribeAttributeDoorLockLanguage() - : SubscribeAttribute("language") - { - } - - ~SubscribeAttributeDoorLockLanguage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLanguageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.Language response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadOccupancySensingOccupancySensorTypeBitmap() + : ReadAttribute("occupancy-sensor-type-bitmap") {} + + ~ReadOccupancySensingOccupancySensorTypeBitmap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOccupancySensorTypeBitmapWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing OccupancySensorTypeBitmap read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() + : SubscribeAttribute("occupancy-sensor-type-bitmap") {} + + ~SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOccupancySensorTypeBitmapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LEDSettings + * Attribute PirOccupiedToUnoccupiedDelay */ -class ReadDoorLockLEDSettings : public ReadAttribute { +class ReadOccupancySensingPirOccupiedToUnoccupiedDelay : public ReadAttribute { public: - ReadDoorLockLEDSettings() - : ReadAttribute("ledsettings") - { - } - - ~ReadDoorLockLEDSettings() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000022) on endpoint %u", endpointId); + ReadOccupancySensingPirOccupiedToUnoccupiedDelay() + : ReadAttribute("pir-occupied-to-unoccupied-delay") {} + + ~ReadOccupancySensingPirOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePIROccupiedToUnoccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing PIROccupiedToUnoccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPirOccupiedToUnoccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingPirOccupiedToUnoccupiedDelay() + : WriteAttribute("pir-occupied-to-unoccupied-delay") { + AddArgument("attr-name", "pir-occupied-to-unoccupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPirOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributePIROccupiedToUnoccupiedDelayWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "OccupancySensing " + "PIROccupiedToUnoccupi" + "edDelay write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLEDSettingsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LEDSettings response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock LEDSettings read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class WriteDoorLockLEDSettings : public WriteAttribute { +class SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay + : public SubscribeAttribute { public: - WriteDoorLockLEDSettings() - : WriteAttribute("ledsettings") - { - AddArgument("attr-name", "ledsettings"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } + SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay() + : SubscribeAttribute("pir-occupied-to-unoccupied-delay") {} - ~WriteDoorLockLEDSettings() {} + ~SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeLEDSettingsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock LEDSettings write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockLEDSettings : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockLEDSettings() - : SubscribeAttribute("ledsettings") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeDoorLockLEDSettings() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePIROccupiedToUnoccupiedDelayWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLEDSettingsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LEDSettings response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AutoRelockTime + * Attribute PirUnoccupiedToOccupiedDelay */ -class ReadDoorLockAutoRelockTime : public ReadAttribute { +class ReadOccupancySensingPirUnoccupiedToOccupiedDelay : public ReadAttribute { public: - ReadDoorLockAutoRelockTime() - : ReadAttribute("auto-relock-time") - { - } - - ~ReadDoorLockAutoRelockTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000023) on endpoint %u", endpointId); + ReadOccupancySensingPirUnoccupiedToOccupiedDelay() + : ReadAttribute("pir-unoccupied-to-occupied-delay") {} + + ~ReadOccupancySensingPirUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePIRUnoccupiedToOccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing PIRUnoccupiedToOccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPirUnoccupiedToOccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingPirUnoccupiedToOccupiedDelay() + : WriteAttribute("pir-unoccupied-to-occupied-delay") { + AddArgument("attr-name", "pir-unoccupied-to-occupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPirUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributePIRUnoccupiedToOccupiedDelayWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "OccupancySensing " + "PIRUnoccupiedToOccupi" + "edDelay write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock AutoRelockTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class WriteDoorLockAutoRelockTime : public WriteAttribute { +class SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay + : public SubscribeAttribute { public: - WriteDoorLockAutoRelockTime() - : WriteAttribute("auto-relock-time") - { - AddArgument("attr-name", "auto-relock-time"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockAutoRelockTime() {} + SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay() + : SubscribeAttribute("pir-unoccupied-to-occupied-delay") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + ~SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay() {} - [cluster writeAttributeAutoRelockTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock AutoRelockTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeDoorLockAutoRelockTime : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockAutoRelockTime() - : SubscribeAttribute("auto-relock-time") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeDoorLockAutoRelockTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePIRUnoccupiedToOccupiedDelayWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAutoRelockTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SoundVolume - */ -class ReadDoorLockSoundVolume : public ReadAttribute { -public: - ReadDoorLockSoundVolume() - : ReadAttribute("sound-volume") - { - } - - ~ReadDoorLockSoundVolume() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSoundVolumeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SoundVolume response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock SoundVolume read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockSoundVolume : public WriteAttribute { -public: - WriteDoorLockSoundVolume() - : WriteAttribute("sound-volume") - { - AddArgument("attr-name", "sound-volume"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockSoundVolume() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSoundVolumeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock SoundVolume write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockSoundVolume : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockSoundVolume() - : SubscribeAttribute("sound-volume") - { - } - - ~SubscribeAttributeDoorLockSoundVolume() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSoundVolumeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SoundVolume response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OperatingMode - */ -class ReadDoorLockOperatingMode : public ReadAttribute { -public: - ReadDoorLockOperatingMode() - : ReadAttribute("operating-mode") - { - } - - ~ReadDoorLockOperatingMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOperatingModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.OperatingMode response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock OperatingMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockOperatingMode : public WriteAttribute { -public: - WriteDoorLockOperatingMode() - : WriteAttribute("operating-mode") - { - AddArgument("attr-name", "operating-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockOperatingMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOperatingModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock OperatingMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockOperatingMode : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockOperatingMode() - : SubscribeAttribute("operating-mode") - { - } - - ~SubscribeAttributeDoorLockOperatingMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOperatingModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.OperatingMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SupportedOperatingModes - */ -class ReadDoorLockSupportedOperatingModes : public ReadAttribute { -public: - ReadDoorLockSupportedOperatingModes() - : ReadAttribute("supported-operating-modes") - { - } - - ~ReadDoorLockSupportedOperatingModes() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSupportedOperatingModesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SupportedOperatingModes response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock SupportedOperatingModes read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockSupportedOperatingModes : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockSupportedOperatingModes() - : SubscribeAttribute("supported-operating-modes") - { - } - - ~SubscribeAttributeDoorLockSupportedOperatingModes() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSupportedOperatingModesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SupportedOperatingModes response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute DefaultConfigurationRegister - */ -class ReadDoorLockDefaultConfigurationRegister : public ReadAttribute { -public: - ReadDoorLockDefaultConfigurationRegister() - : ReadAttribute("default-configuration-register") - { - } - - ~ReadDoorLockDefaultConfigurationRegister() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000027) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDefaultConfigurationRegisterWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DefaultConfigurationRegister response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock DefaultConfigurationRegister read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockDefaultConfigurationRegister : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockDefaultConfigurationRegister() - : SubscribeAttribute("default-configuration-register") - { - } - - ~SubscribeAttributeDoorLockDefaultConfigurationRegister() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDefaultConfigurationRegisterWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.DefaultConfigurationRegister response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnableLocalProgramming - */ -class ReadDoorLockEnableLocalProgramming : public ReadAttribute { -public: - ReadDoorLockEnableLocalProgramming() - : ReadAttribute("enable-local-programming") - { - } - - ~ReadDoorLockEnableLocalProgramming() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000028) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeEnableLocalProgrammingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableLocalProgramming response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock EnableLocalProgramming read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockEnableLocalProgramming : public WriteAttribute { -public: - WriteDoorLockEnableLocalProgramming() - : WriteAttribute("enable-local-programming") - { - AddArgument("attr-name", "enable-local-programming"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockEnableLocalProgramming() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeEnableLocalProgrammingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock EnableLocalProgramming write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockEnableLocalProgramming : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockEnableLocalProgramming() - : SubscribeAttribute("enable-local-programming") - { - } - - ~SubscribeAttributeDoorLockEnableLocalProgramming() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnableLocalProgrammingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableLocalProgramming response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnableOneTouchLocking - */ -class ReadDoorLockEnableOneTouchLocking : public ReadAttribute { -public: - ReadDoorLockEnableOneTouchLocking() - : ReadAttribute("enable-one-touch-locking") - { - } - - ~ReadDoorLockEnableOneTouchLocking() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000029) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeEnableOneTouchLockingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock EnableOneTouchLocking read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockEnableOneTouchLocking : public WriteAttribute { -public: - WriteDoorLockEnableOneTouchLocking() - : WriteAttribute("enable-one-touch-locking") - { - AddArgument("attr-name", "enable-one-touch-locking"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockEnableOneTouchLocking() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeEnableOneTouchLockingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock EnableOneTouchLocking write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockEnableOneTouchLocking : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockEnableOneTouchLocking() - : SubscribeAttribute("enable-one-touch-locking") - { - } - - ~SubscribeAttributeDoorLockEnableOneTouchLocking() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnableOneTouchLockingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnableInsideStatusLED - */ -class ReadDoorLockEnableInsideStatusLED : public ReadAttribute { -public: - ReadDoorLockEnableInsideStatusLED() - : ReadAttribute("enable-inside-status-led") - { - } - - ~ReadDoorLockEnableInsideStatusLED() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000002A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeEnableInsideStatusLEDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableInsideStatusLED response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock EnableInsideStatusLED read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockEnableInsideStatusLED : public WriteAttribute { -public: - WriteDoorLockEnableInsideStatusLED() - : WriteAttribute("enable-inside-status-led") - { - AddArgument("attr-name", "enable-inside-status-led"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockEnableInsideStatusLED() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeEnableInsideStatusLEDWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock EnableInsideStatusLED write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockEnableInsideStatusLED : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockEnableInsideStatusLED() - : SubscribeAttribute("enable-inside-status-led") - { - } - - ~SubscribeAttributeDoorLockEnableInsideStatusLED() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnableInsideStatusLEDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnableInsideStatusLED response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnablePrivacyModeButton - */ -class ReadDoorLockEnablePrivacyModeButton : public ReadAttribute { -public: - ReadDoorLockEnablePrivacyModeButton() - : ReadAttribute("enable-privacy-mode-button") - { - } - - ~ReadDoorLockEnablePrivacyModeButton() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000002B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeEnablePrivacyModeButtonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnablePrivacyModeButton response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock EnablePrivacyModeButton read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockEnablePrivacyModeButton : public WriteAttribute { -public: - WriteDoorLockEnablePrivacyModeButton() - : WriteAttribute("enable-privacy-mode-button") - { - AddArgument("attr-name", "enable-privacy-mode-button"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockEnablePrivacyModeButton() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x0000002B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeEnablePrivacyModeButtonWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock EnablePrivacyModeButton write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockEnablePrivacyModeButton : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockEnablePrivacyModeButton() - : SubscribeAttribute("enable-privacy-mode-button") - { - } - - ~SubscribeAttributeDoorLockEnablePrivacyModeButton() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000002B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnablePrivacyModeButtonWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.EnablePrivacyModeButton response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LocalProgrammingFeatures - */ -class ReadDoorLockLocalProgrammingFeatures : public ReadAttribute { -public: - ReadDoorLockLocalProgrammingFeatures() - : ReadAttribute("local-programming-features") - { - } - - ~ReadDoorLockLocalProgrammingFeatures() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000002C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLocalProgrammingFeaturesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LocalProgrammingFeatures response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock LocalProgrammingFeatures read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockLocalProgrammingFeatures : public WriteAttribute { -public: - WriteDoorLockLocalProgrammingFeatures() - : WriteAttribute("local-programming-features") - { - AddArgument("attr-name", "local-programming-features"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockLocalProgrammingFeatures() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x0000002C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeLocalProgrammingFeaturesWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock LocalProgrammingFeatures write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockLocalProgrammingFeatures : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockLocalProgrammingFeatures() - : SubscribeAttribute("local-programming-features") - { - } - - ~SubscribeAttributeDoorLockLocalProgrammingFeatures() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000002C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocalProgrammingFeaturesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.LocalProgrammingFeatures response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute WrongCodeEntryLimit - */ -class ReadDoorLockWrongCodeEntryLimit : public ReadAttribute { -public: - ReadDoorLockWrongCodeEntryLimit() - : ReadAttribute("wrong-code-entry-limit") - { - } - - ~ReadDoorLockWrongCodeEntryLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeWrongCodeEntryLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock WrongCodeEntryLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockWrongCodeEntryLimit : public WriteAttribute { -public: - WriteDoorLockWrongCodeEntryLimit() - : WriteAttribute("wrong-code-entry-limit") - { - AddArgument("attr-name", "wrong-code-entry-limit"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockWrongCodeEntryLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeWrongCodeEntryLimitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock WrongCodeEntryLimit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockWrongCodeEntryLimit : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockWrongCodeEntryLimit() - : SubscribeAttribute("wrong-code-entry-limit") - { - } - - ~SubscribeAttributeDoorLockWrongCodeEntryLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWrongCodeEntryLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UserCodeTemporaryDisableTime - */ -class ReadDoorLockUserCodeTemporaryDisableTime : public ReadAttribute { -public: - ReadDoorLockUserCodeTemporaryDisableTime() - : ReadAttribute("user-code-temporary-disable-time") - { - } - - ~ReadDoorLockUserCodeTemporaryDisableTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock UserCodeTemporaryDisableTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockUserCodeTemporaryDisableTime : public WriteAttribute { -public: - WriteDoorLockUserCodeTemporaryDisableTime() - : WriteAttribute("user-code-temporary-disable-time") - { - AddArgument("attr-name", "user-code-temporary-disable-time"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockUserCodeTemporaryDisableTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeUserCodeTemporaryDisableTimeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock UserCodeTemporaryDisableTime write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeDoorLockUserCodeTemporaryDisableTime : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() - : SubscribeAttribute("user-code-temporary-disable-time") - { - } - - ~SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUserCodeTemporaryDisableTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SendPINOverTheAir - */ -class ReadDoorLockSendPINOverTheAir : public ReadAttribute { -public: - ReadDoorLockSendPINOverTheAir() - : ReadAttribute("send-pinover-the-air") - { - } - - ~ReadDoorLockSendPINOverTheAir() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSendPINOverTheAirWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock SendPINOverTheAir read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockSendPINOverTheAir : public WriteAttribute { -public: - WriteDoorLockSendPINOverTheAir() - : WriteAttribute("send-pinover-the-air") - { - AddArgument("attr-name", "send-pinover-the-air"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockSendPINOverTheAir() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeSendPINOverTheAirWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock SendPINOverTheAir write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockSendPINOverTheAir : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockSendPINOverTheAir() - : SubscribeAttribute("send-pinover-the-air") - { - } - - ~SubscribeAttributeDoorLockSendPINOverTheAir() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSendPINOverTheAirWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute RequirePINforRemoteOperation - */ -class ReadDoorLockRequirePINforRemoteOperation : public ReadAttribute { -public: - ReadDoorLockRequirePINforRemoteOperation() - : ReadAttribute("require-pinfor-remote-operation") - { - } - - ~ReadDoorLockRequirePINforRemoteOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000033) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock RequirePINforRemoteOperation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockRequirePINforRemoteOperation : public WriteAttribute { -public: - WriteDoorLockRequirePINforRemoteOperation() - : WriteAttribute("require-pinfor-remote-operation") - { - AddArgument("attr-name", "require-pinfor-remote-operation"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockRequirePINforRemoteOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster - writeAttributeRequirePINforRemoteOperationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock RequirePINforRemoteOperation write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeDoorLockRequirePINforRemoteOperation : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockRequirePINforRemoteOperation() - : SubscribeAttribute("require-pinfor-remote-operation") - { - } - - ~SubscribeAttributeDoorLockRequirePINforRemoteOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRequirePINforRemoteOperationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ExpiringUserTimeout - */ -class ReadDoorLockExpiringUserTimeout : public ReadAttribute { -public: - ReadDoorLockExpiringUserTimeout() - : ReadAttribute("expiring-user-timeout") - { - } - - ~ReadDoorLockExpiringUserTimeout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x00000035) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeExpiringUserTimeoutWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ExpiringUserTimeout response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock ExpiringUserTimeout read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteDoorLockExpiringUserTimeout : public WriteAttribute { -public: - WriteDoorLockExpiringUserTimeout() - : WriteAttribute("expiring-user-timeout") - { - AddArgument("attr-name", "expiring-user-timeout"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteDoorLockExpiringUserTimeout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) WriteAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeExpiringUserTimeoutWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("DoorLock ExpiringUserTimeout write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeDoorLockExpiringUserTimeout : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockExpiringUserTimeout() - : SubscribeAttribute("expiring-user-timeout") - { - } - - ~SubscribeAttributeDoorLockExpiringUserTimeout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeExpiringUserTimeoutWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ExpiringUserTimeout response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadDoorLockGeneratedCommandList : public ReadAttribute { -public: - ReadDoorLockGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadDoorLockGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeDoorLockGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadDoorLockAcceptedCommandList : public ReadAttribute { -public: - ReadDoorLockAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadDoorLockAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeDoorLockAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadDoorLockAttributeList : public ReadAttribute { -public: - ReadDoorLockAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadDoorLockAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeDoorLockAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadDoorLockFeatureMap : public ReadAttribute { -public: - ReadDoorLockFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadDoorLockFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeDoorLockFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadDoorLockClusterRevision : public ReadAttribute { -public: - ReadDoorLockClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadDoorLockClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("DoorLock ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeDoorLockClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeDoorLockClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeDoorLockClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000101) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"DoorLock.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster WindowCovering | 0x0102 | -|------------------------------------------------------------------------------| -| Commands: | | -| * UpOrOpen | 0x00 | -| * DownOrClose | 0x01 | -| * StopMotion | 0x02 | -| * GoToLiftValue | 0x04 | -| * GoToLiftPercentage | 0x05 | -| * GoToTiltValue | 0x07 | -| * GoToTiltPercentage | 0x08 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * Type | 0x0000 | -| * PhysicalClosedLimitLift | 0x0001 | -| * PhysicalClosedLimitTilt | 0x0002 | -| * CurrentPositionLift | 0x0003 | -| * CurrentPositionTilt | 0x0004 | -| * NumberOfActuationsLift | 0x0005 | -| * NumberOfActuationsTilt | 0x0006 | -| * ConfigStatus | 0x0007 | -| * CurrentPositionLiftPercentage | 0x0008 | -| * CurrentPositionTiltPercentage | 0x0009 | -| * OperationalStatus | 0x000A | -| * TargetPositionLiftPercent100ths | 0x000B | -| * TargetPositionTiltPercent100ths | 0x000C | -| * EndProductType | 0x000D | -| * CurrentPositionLiftPercent100ths | 0x000E | -| * CurrentPositionTiltPercent100ths | 0x000F | -| * InstalledOpenLimitLift | 0x0010 | -| * InstalledClosedLimitLift | 0x0011 | -| * InstalledOpenLimitTilt | 0x0012 | -| * InstalledClosedLimitTilt | 0x0013 | -| * Mode | 0x0017 | -| * SafetyStatus | 0x001A | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command UpOrOpen - */ -class WindowCoveringUpOrOpen : public ClusterCommand { -public: - WindowCoveringUpOrOpen() - : ClusterCommand("up-or-open") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterUpOrOpenParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster upOrOpenWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command DownOrClose - */ -class WindowCoveringDownOrClose : public ClusterCommand { -public: - WindowCoveringDownOrClose() - : ClusterCommand("down-or-close") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterDownOrCloseParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster downOrCloseWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command StopMotion - */ -class WindowCoveringStopMotion : public ClusterCommand { -public: - WindowCoveringStopMotion() - : ClusterCommand("stop-motion") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterStopMotionParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopMotionWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command GoToLiftValue - */ -class WindowCoveringGoToLiftValue : public ClusterCommand { -public: - WindowCoveringGoToLiftValue() - : ClusterCommand("go-to-lift-value") - { - AddArgument("LiftValue", 0, UINT16_MAX, &mRequest.liftValue); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterGoToLiftValueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.liftValue = [NSNumber numberWithUnsignedShort:mRequest.liftValue]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster goToLiftValueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Type mRequest; -}; - -/* - * Command GoToLiftPercentage - */ -class WindowCoveringGoToLiftPercentage : public ClusterCommand { -public: - WindowCoveringGoToLiftPercentage() - : ClusterCommand("go-to-lift-percentage") - { - AddArgument("LiftPercent100thsValue", 0, UINT16_MAX, &mRequest.liftPercent100thsValue); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:mRequest.liftPercent100thsValue]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster goToLiftPercentageWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type mRequest; -}; - -/* - * Command GoToTiltValue - */ -class WindowCoveringGoToTiltValue : public ClusterCommand { -public: - WindowCoveringGoToTiltValue() - : ClusterCommand("go-to-tilt-value") - { - AddArgument("TiltValue", 0, UINT16_MAX, &mRequest.tiltValue); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterGoToTiltValueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.tiltValue = [NSNumber numberWithUnsignedShort:mRequest.tiltValue]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster goToTiltValueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Type mRequest; -}; - -/* - * Command GoToTiltPercentage - */ -class WindowCoveringGoToTiltPercentage : public ClusterCommand { -public: - WindowCoveringGoToTiltPercentage() - : ClusterCommand("go-to-tilt-percentage") - { - AddArgument("TiltPercent100thsValue", 0, UINT16_MAX, &mRequest.tiltPercent100thsValue); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:mRequest.tiltPercent100thsValue]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster goToTiltPercentageWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type mRequest; -}; - -/* - * Attribute Type - */ -class ReadWindowCoveringType : public ReadAttribute { -public: - ReadWindowCoveringType() - : ReadAttribute("type") - { - } - - ~ReadWindowCoveringType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.Type response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering Type read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringType : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringType() - : SubscribeAttribute("type") - { - } - - ~SubscribeAttributeWindowCoveringType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.Type response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalClosedLimitLift - */ -class ReadWindowCoveringPhysicalClosedLimitLift : public ReadAttribute { -public: - ReadWindowCoveringPhysicalClosedLimitLift() - : ReadAttribute("physical-closed-limit-lift") - { - } - - ~ReadWindowCoveringPhysicalClosedLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalClosedLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering PhysicalClosedLimitLift read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringPhysicalClosedLimitLift : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() - : SubscribeAttribute("physical-closed-limit-lift") - { - } - - ~SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalClosedLimitLiftWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalClosedLimitTilt - */ -class ReadWindowCoveringPhysicalClosedLimitTilt : public ReadAttribute { -public: - ReadWindowCoveringPhysicalClosedLimitTilt() - : ReadAttribute("physical-closed-limit-tilt") - { - } - - ~ReadWindowCoveringPhysicalClosedLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalClosedLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering PhysicalClosedLimitTilt read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() - : SubscribeAttribute("physical-closed-limit-tilt") - { - } - - ~SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalClosedLimitTiltWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionLift - */ -class ReadWindowCoveringCurrentPositionLift : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionLift() - : ReadAttribute("current-position-lift") - { - } - - ~ReadWindowCoveringCurrentPositionLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentPositionLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLift response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionLift read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionLift : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionLift() - : SubscribeAttribute("current-position-lift") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionLiftWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLift response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionTilt - */ -class ReadWindowCoveringCurrentPositionTilt : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionTilt() - : ReadAttribute("current-position-tilt") - { - } - - ~ReadWindowCoveringCurrentPositionTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentPositionTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTilt response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionTilt read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionTilt : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionTilt() - : SubscribeAttribute("current-position-tilt") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionTiltWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTilt response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute NumberOfActuationsLift - */ -class ReadWindowCoveringNumberOfActuationsLift : public ReadAttribute { -public: - ReadWindowCoveringNumberOfActuationsLift() - : ReadAttribute("number-of-actuations-lift") - { - } - - ~ReadWindowCoveringNumberOfActuationsLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNumberOfActuationsLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.NumberOfActuationsLift response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering NumberOfActuationsLift read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringNumberOfActuationsLift : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringNumberOfActuationsLift() - : SubscribeAttribute("number-of-actuations-lift") - { - } - - ~SubscribeAttributeWindowCoveringNumberOfActuationsLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfActuationsLiftWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.NumberOfActuationsLift response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute NumberOfActuationsTilt - */ -class ReadWindowCoveringNumberOfActuationsTilt : public ReadAttribute { -public: - ReadWindowCoveringNumberOfActuationsTilt() - : ReadAttribute("number-of-actuations-tilt") - { - } - - ~ReadWindowCoveringNumberOfActuationsTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNumberOfActuationsTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering NumberOfActuationsTilt read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringNumberOfActuationsTilt : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringNumberOfActuationsTilt() - : SubscribeAttribute("number-of-actuations-tilt") - { - } - - ~SubscribeAttributeWindowCoveringNumberOfActuationsTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfActuationsTiltWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ConfigStatus - */ -class ReadWindowCoveringConfigStatus : public ReadAttribute { -public: - ReadWindowCoveringConfigStatus() - : ReadAttribute("config-status") - { - } - - ~ReadWindowCoveringConfigStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeConfigStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering ConfigStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringConfigStatus : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringConfigStatus() - : SubscribeAttribute("config-status") - { - } - - ~SubscribeAttributeWindowCoveringConfigStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeConfigStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionLiftPercentage - */ -class ReadWindowCoveringCurrentPositionLiftPercentage : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionLiftPercentage() - : ReadAttribute("current-position-lift-percentage") - { - } - - ~ReadWindowCoveringCurrentPositionLiftPercentage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentPositionLiftPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionLiftPercentage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() - : SubscribeAttribute("current-position-lift-percentage") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionLiftPercentageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionTiltPercentage - */ -class ReadWindowCoveringCurrentPositionTiltPercentage : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionTiltPercentage() - : ReadAttribute("current-position-tilt-percentage") - { - } - - ~ReadWindowCoveringCurrentPositionTiltPercentage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentPositionTiltPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionTiltPercentage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() - : SubscribeAttribute("current-position-tilt-percentage") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionTiltPercentageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OperationalStatus - */ -class ReadWindowCoveringOperationalStatus : public ReadAttribute { -public: - ReadWindowCoveringOperationalStatus() - : ReadAttribute("operational-status") - { - } - - ~ReadWindowCoveringOperationalStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOperationalStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.OperationalStatus response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering OperationalStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringOperationalStatus : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringOperationalStatus() - : SubscribeAttribute("operational-status") - { - } - - ~SubscribeAttributeWindowCoveringOperationalStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOperationalStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.OperationalStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute TargetPositionLiftPercent100ths - */ -class ReadWindowCoveringTargetPositionLiftPercent100ths : public ReadAttribute { -public: - ReadWindowCoveringTargetPositionLiftPercent100ths() - : ReadAttribute("target-position-lift-percent100ths") - { - } - - ~ReadWindowCoveringTargetPositionLiftPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeTargetPositionLiftPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering TargetPositionLiftPercent100ths read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() - : SubscribeAttribute("target-position-lift-percent100ths") - { - } - - ~SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTargetPositionLiftPercent100thsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute TargetPositionTiltPercent100ths - */ -class ReadWindowCoveringTargetPositionTiltPercent100ths : public ReadAttribute { -public: - ReadWindowCoveringTargetPositionTiltPercent100ths() - : ReadAttribute("target-position-tilt-percent100ths") - { - } - - ~ReadWindowCoveringTargetPositionTiltPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeTargetPositionTiltPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering TargetPositionTiltPercent100ths read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() - : SubscribeAttribute("target-position-tilt-percent100ths") - { - } - - ~SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTargetPositionTiltPercent100thsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EndProductType - */ -class ReadWindowCoveringEndProductType : public ReadAttribute { -public: - ReadWindowCoveringEndProductType() - : ReadAttribute("end-product-type") - { - } - - ~ReadWindowCoveringEndProductType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEndProductTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.EndProductType response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering EndProductType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringEndProductType : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringEndProductType() - : SubscribeAttribute("end-product-type") - { - } - - ~SubscribeAttributeWindowCoveringEndProductType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEndProductTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.EndProductType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionLiftPercent100ths - */ -class ReadWindowCoveringCurrentPositionLiftPercent100ths : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionLiftPercent100ths() - : ReadAttribute("current-position-lift-percent100ths") - { - } - - ~ReadWindowCoveringCurrentPositionLiftPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionLiftPercent100ths read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() - : SubscribeAttribute("current-position-lift-percent100ths") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionLiftPercent100thsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentPositionTiltPercent100ths - */ -class ReadWindowCoveringCurrentPositionTiltPercent100ths : public ReadAttribute { -public: - ReadWindowCoveringCurrentPositionTiltPercent100ths() - : ReadAttribute("current-position-tilt-percent100ths") - { - } - - ~ReadWindowCoveringCurrentPositionTiltPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering CurrentPositionTiltPercent100ths read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() - : SubscribeAttribute("current-position-tilt-percent100ths") - { - } - - ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentPositionTiltPercent100thsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute InstalledOpenLimitLift - */ -class ReadWindowCoveringInstalledOpenLimitLift : public ReadAttribute { -public: - ReadWindowCoveringInstalledOpenLimitLift() - : ReadAttribute("installed-open-limit-lift") - { - } - - ~ReadWindowCoveringInstalledOpenLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstalledOpenLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering InstalledOpenLimitLift read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringInstalledOpenLimitLift : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringInstalledOpenLimitLift() - : SubscribeAttribute("installed-open-limit-lift") - { - } - - ~SubscribeAttributeWindowCoveringInstalledOpenLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstalledOpenLimitLiftWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute InstalledClosedLimitLift - */ -class ReadWindowCoveringInstalledClosedLimitLift : public ReadAttribute { -public: - ReadWindowCoveringInstalledClosedLimitLift() - : ReadAttribute("installed-closed-limit-lift") - { - } - - ~ReadWindowCoveringInstalledClosedLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstalledClosedLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering InstalledClosedLimitLift read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringInstalledClosedLimitLift : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringInstalledClosedLimitLift() - : SubscribeAttribute("installed-closed-limit-lift") - { - } - - ~SubscribeAttributeWindowCoveringInstalledClosedLimitLift() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstalledClosedLimitLiftWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute InstalledOpenLimitTilt - */ -class ReadWindowCoveringInstalledOpenLimitTilt : public ReadAttribute { -public: - ReadWindowCoveringInstalledOpenLimitTilt() - : ReadAttribute("installed-open-limit-tilt") - { - } - - ~ReadWindowCoveringInstalledOpenLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstalledOpenLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering InstalledOpenLimitTilt read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringInstalledOpenLimitTilt : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() - : SubscribeAttribute("installed-open-limit-tilt") - { - } - - ~SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstalledOpenLimitTiltWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute InstalledClosedLimitTilt - */ -class ReadWindowCoveringInstalledClosedLimitTilt : public ReadAttribute { -public: - ReadWindowCoveringInstalledClosedLimitTilt() - : ReadAttribute("installed-closed-limit-tilt") - { - } - - ~ReadWindowCoveringInstalledClosedLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstalledClosedLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering InstalledClosedLimitTilt read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringInstalledClosedLimitTilt : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() - : SubscribeAttribute("installed-closed-limit-tilt") - { - } - - ~SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstalledClosedLimitTiltWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Mode - */ -class ReadWindowCoveringMode : public ReadAttribute { -public: - ReadWindowCoveringMode() - : ReadAttribute("mode") - { - } - - ~ReadWindowCoveringMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.Mode response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering Mode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteWindowCoveringMode : public WriteAttribute { -public: - WriteWindowCoveringMode() - : WriteAttribute("mode") - { - AddArgument("attr-name", "mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteWindowCoveringMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) WriteAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("WindowCovering Mode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeWindowCoveringMode : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringMode() - : SubscribeAttribute("mode") - { - } - - ~SubscribeAttributeWindowCoveringMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.Mode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SafetyStatus - */ -class ReadWindowCoveringSafetyStatus : public ReadAttribute { -public: - ReadWindowCoveringSafetyStatus() - : ReadAttribute("safety-status") - { - } - - ~ReadWindowCoveringSafetyStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSafetyStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering SafetyStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringSafetyStatus : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringSafetyStatus() - : SubscribeAttribute("safety-status") - { - } - - ~SubscribeAttributeWindowCoveringSafetyStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSafetyStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadWindowCoveringGeneratedCommandList : public ReadAttribute { -public: - ReadWindowCoveringGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadWindowCoveringGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeWindowCoveringGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadWindowCoveringAcceptedCommandList : public ReadAttribute { -public: - ReadWindowCoveringAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadWindowCoveringAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeWindowCoveringAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadWindowCoveringAttributeList : public ReadAttribute { -public: - ReadWindowCoveringAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadWindowCoveringAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeWindowCoveringAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadWindowCoveringFeatureMap : public ReadAttribute { -public: - ReadWindowCoveringFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadWindowCoveringFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeWindowCoveringFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadWindowCoveringClusterRevision : public ReadAttribute { -public: - ReadWindowCoveringClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadWindowCoveringClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("WindowCovering ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWindowCoveringClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeWindowCoveringClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeWindowCoveringClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000102) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster BarrierControl | 0x0103 | -|------------------------------------------------------------------------------| -| Commands: | | -| * BarrierControlGoToPercent | 0x00 | -| * BarrierControlStop | 0x01 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * BarrierMovingState | 0x0001 | -| * BarrierSafetyStatus | 0x0002 | -| * BarrierCapabilities | 0x0003 | -| * BarrierOpenEvents | 0x0004 | -| * BarrierCloseEvents | 0x0005 | -| * BarrierCommandOpenEvents | 0x0006 | -| * BarrierCommandCloseEvents | 0x0007 | -| * BarrierOpenPeriod | 0x0008 | -| * BarrierClosePeriod | 0x0009 | -| * BarrierPosition | 0x000A | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command BarrierControlGoToPercent - */ -class BarrierControlBarrierControlGoToPercent : public ClusterCommand { -public: - BarrierControlBarrierControlGoToPercent() - : ClusterCommand("barrier-control-go-to-percent") - { - AddArgument("PercentOpen", 0, UINT8_MAX, &mRequest.percentOpen); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRBarrierControlClusterBarrierControlGoToPercentParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.percentOpen = [NSNumber numberWithUnsignedChar:mRequest.percentOpen]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster barrierControlGoToPercentWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::BarrierControl::Commands::BarrierControlGoToPercent::Type mRequest; -}; - -/* - * Command BarrierControlStop - */ -class BarrierControlBarrierControlStop : public ClusterCommand { -public: - BarrierControlBarrierControlStop() - : ClusterCommand("barrier-control-stop") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRBarrierControlClusterBarrierControlStopParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster barrierControlStopWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Attribute BarrierMovingState - */ -class ReadBarrierControlBarrierMovingState : public ReadAttribute { -public: - ReadBarrierControlBarrierMovingState() - : ReadAttribute("barrier-moving-state") - { - } - - ~ReadBarrierControlBarrierMovingState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierMovingStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierMovingState response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierMovingState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlBarrierMovingState : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierMovingState() - : SubscribeAttribute("barrier-moving-state") - { - } - - ~SubscribeAttributeBarrierControlBarrierMovingState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierMovingStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierMovingState response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierSafetyStatus - */ -class ReadBarrierControlBarrierSafetyStatus : public ReadAttribute { -public: - ReadBarrierControlBarrierSafetyStatus() - : ReadAttribute("barrier-safety-status") - { - } - - ~ReadBarrierControlBarrierSafetyStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierSafetyStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierSafetyStatus response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierSafetyStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlBarrierSafetyStatus : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierSafetyStatus() - : SubscribeAttribute("barrier-safety-status") - { - } - - ~SubscribeAttributeBarrierControlBarrierSafetyStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierSafetyStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierSafetyStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierCapabilities - */ -class ReadBarrierControlBarrierCapabilities : public ReadAttribute { -public: - ReadBarrierControlBarrierCapabilities() - : ReadAttribute("barrier-capabilities") - { - } - - ~ReadBarrierControlBarrierCapabilities() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierCapabilitiesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCapabilities response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierCapabilities read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlBarrierCapabilities : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierCapabilities() - : SubscribeAttribute("barrier-capabilities") - { - } - - ~SubscribeAttributeBarrierControlBarrierCapabilities() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierCapabilitiesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCapabilities response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierOpenEvents - */ -class ReadBarrierControlBarrierOpenEvents : public ReadAttribute { -public: - ReadBarrierControlBarrierOpenEvents() - : ReadAttribute("barrier-open-events") - { - } - - ~ReadBarrierControlBarrierOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierOpenEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierOpenEvents response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierOpenEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierOpenEvents : public WriteAttribute { -public: - WriteBarrierControlBarrierOpenEvents() - : WriteAttribute("barrier-open-events") - { - AddArgument("attr-name", "barrier-open-events"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeBarrierOpenEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierOpenEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierOpenEvents : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierOpenEvents() - : SubscribeAttribute("barrier-open-events") - { - } - - ~SubscribeAttributeBarrierControlBarrierOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierOpenEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierOpenEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierCloseEvents - */ -class ReadBarrierControlBarrierCloseEvents : public ReadAttribute { -public: - ReadBarrierControlBarrierCloseEvents() - : ReadAttribute("barrier-close-events") - { - } - - ~ReadBarrierControlBarrierCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierCloseEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCloseEvents response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierCloseEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierCloseEvents : public WriteAttribute { -public: - WriteBarrierControlBarrierCloseEvents() - : WriteAttribute("barrier-close-events") - { - AddArgument("attr-name", "barrier-close-events"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeBarrierCloseEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierCloseEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierCloseEvents : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierCloseEvents() - : SubscribeAttribute("barrier-close-events") - { - } - - ~SubscribeAttributeBarrierControlBarrierCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierCloseEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCloseEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierCommandOpenEvents - */ -class ReadBarrierControlBarrierCommandOpenEvents : public ReadAttribute { -public: - ReadBarrierControlBarrierCommandOpenEvents() - : ReadAttribute("barrier-command-open-events") - { - } - - ~ReadBarrierControlBarrierCommandOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierCommandOpenEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCommandOpenEvents response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierCommandOpenEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierCommandOpenEvents : public WriteAttribute { -public: - WriteBarrierControlBarrierCommandOpenEvents() - : WriteAttribute("barrier-command-open-events") - { - AddArgument("attr-name", "barrier-command-open-events"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierCommandOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeBarrierCommandOpenEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierCommandOpenEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierCommandOpenEvents : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierCommandOpenEvents() - : SubscribeAttribute("barrier-command-open-events") - { - } - - ~SubscribeAttributeBarrierControlBarrierCommandOpenEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierCommandOpenEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCommandOpenEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierCommandCloseEvents - */ -class ReadBarrierControlBarrierCommandCloseEvents : public ReadAttribute { -public: - ReadBarrierControlBarrierCommandCloseEvents() - : ReadAttribute("barrier-command-close-events") - { - } - - ~ReadBarrierControlBarrierCommandCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierCommandCloseEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCommandCloseEvents response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierCommandCloseEvents read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierCommandCloseEvents : public WriteAttribute { -public: - WriteBarrierControlBarrierCommandCloseEvents() - : WriteAttribute("barrier-command-close-events") - { - AddArgument("attr-name", "barrier-command-close-events"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierCommandCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeBarrierCommandCloseEventsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierCommandCloseEvents write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierCommandCloseEvents : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierCommandCloseEvents() - : SubscribeAttribute("barrier-command-close-events") - { - } - - ~SubscribeAttributeBarrierControlBarrierCommandCloseEvents() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierCommandCloseEventsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierCommandCloseEvents response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierOpenPeriod - */ -class ReadBarrierControlBarrierOpenPeriod : public ReadAttribute { -public: - ReadBarrierControlBarrierOpenPeriod() - : ReadAttribute("barrier-open-period") - { - } - - ~ReadBarrierControlBarrierOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierOpenPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierOpenPeriod response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierOpenPeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierOpenPeriod : public WriteAttribute { -public: - WriteBarrierControlBarrierOpenPeriod() - : WriteAttribute("barrier-open-period") - { - AddArgument("attr-name", "barrier-open-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeBarrierOpenPeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierOpenPeriod write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierOpenPeriod : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierOpenPeriod() - : SubscribeAttribute("barrier-open-period") - { - } - - ~SubscribeAttributeBarrierControlBarrierOpenPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierOpenPeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierOpenPeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierClosePeriod - */ -class ReadBarrierControlBarrierClosePeriod : public ReadAttribute { -public: - ReadBarrierControlBarrierClosePeriod() - : ReadAttribute("barrier-close-period") - { - } - - ~ReadBarrierControlBarrierClosePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierClosePeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierClosePeriod response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierClosePeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBarrierControlBarrierClosePeriod : public WriteAttribute { -public: - WriteBarrierControlBarrierClosePeriod() - : WriteAttribute("barrier-close-period") - { - AddArgument("attr-name", "barrier-close-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBarrierControlBarrierClosePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) WriteAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeBarrierClosePeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BarrierControl BarrierClosePeriod write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeBarrierControlBarrierClosePeriod : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierClosePeriod() - : SubscribeAttribute("barrier-close-period") - { - } - - ~SubscribeAttributeBarrierControlBarrierClosePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierClosePeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierClosePeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BarrierPosition - */ -class ReadBarrierControlBarrierPosition : public ReadAttribute { -public: - ReadBarrierControlBarrierPosition() - : ReadAttribute("barrier-position") - { - } - - ~ReadBarrierControlBarrierPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBarrierPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierPosition response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl BarrierPosition read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlBarrierPosition : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlBarrierPosition() - : SubscribeAttribute("barrier-position") - { - } - - ~SubscribeAttributeBarrierControlBarrierPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBarrierPositionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.BarrierPosition response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadBarrierControlGeneratedCommandList : public ReadAttribute { -public: - ReadBarrierControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBarrierControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeBarrierControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadBarrierControlAcceptedCommandList : public ReadAttribute { -public: - ReadBarrierControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBarrierControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeBarrierControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadBarrierControlAttributeList : public ReadAttribute { -public: - ReadBarrierControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadBarrierControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeBarrierControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadBarrierControlFeatureMap : public ReadAttribute { -public: - ReadBarrierControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadBarrierControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeBarrierControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadBarrierControlClusterRevision : public ReadAttribute { -public: - ReadBarrierControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadBarrierControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BarrierControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBarrierControlClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeBarrierControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeBarrierControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000103) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BarrierControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster PumpConfigurationAndControl | 0x0200 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MaxPressure | 0x0000 | -| * MaxSpeed | 0x0001 | -| * MaxFlow | 0x0002 | -| * MinConstPressure | 0x0003 | -| * MaxConstPressure | 0x0004 | -| * MinCompPressure | 0x0005 | -| * MaxCompPressure | 0x0006 | -| * MinConstSpeed | 0x0007 | -| * MaxConstSpeed | 0x0008 | -| * MinConstFlow | 0x0009 | -| * MaxConstFlow | 0x000A | -| * MinConstTemp | 0x000B | -| * MaxConstTemp | 0x000C | -| * PumpStatus | 0x0010 | -| * EffectiveOperationMode | 0x0011 | -| * EffectiveControlMode | 0x0012 | -| * Capacity | 0x0013 | -| * Speed | 0x0014 | -| * LifetimeRunningHours | 0x0015 | -| * Power | 0x0016 | -| * LifetimeEnergyConsumed | 0x0017 | -| * OperationMode | 0x0020 | -| * ControlMode | 0x0021 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -| * SupplyVoltageLow | 0x0000 | -| * SupplyVoltageHigh | 0x0001 | -| * PowerMissingPhase | 0x0002 | -| * SystemPressureLow | 0x0003 | -| * SystemPressureHigh | 0x0004 | -| * DryRunning | 0x0005 | -| * MotorTemperatureHigh | 0x0006 | -| * PumpMotorFatalFailure | 0x0007 | -| * ElectronicTemperatureHigh | 0x0008 | -| * PumpBlocked | 0x0009 | -| * SensorFailure | 0x000A | -| * ElectronicNonFatalFailure | 0x000B | -| * ElectronicFatalFailure | 0x000C | -| * GeneralFault | 0x000D | -| * Leakage | 0x000E | -| * AirDetection | 0x000F | -| * TurbineOperation | 0x0010 | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MaxPressure - */ -class ReadPumpConfigurationAndControlMaxPressure : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxPressure() - : ReadAttribute("max-pressure") - { - } - - ~ReadPumpConfigurationAndControlMaxPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxPressure read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxPressure : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxPressure() - : SubscribeAttribute("max-pressure") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxPressureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxSpeed - */ -class ReadPumpConfigurationAndControlMaxSpeed : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxSpeed() - : ReadAttribute("max-speed") - { - } - - ~ReadPumpConfigurationAndControlMaxSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxSpeed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxSpeed : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxSpeed() - : SubscribeAttribute("max-speed") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxSpeedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxFlow - */ -class ReadPumpConfigurationAndControlMaxFlow : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxFlow() - : ReadAttribute("max-flow") - { - } - - ~ReadPumpConfigurationAndControlMaxFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxFlow read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxFlow : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxFlow() - : SubscribeAttribute("max-flow") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxFlowWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinConstPressure - */ -class ReadPumpConfigurationAndControlMinConstPressure : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMinConstPressure() - : ReadAttribute("min-const-pressure") - { - } - - ~ReadPumpConfigurationAndControlMinConstPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinConstPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MinConstPressure read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMinConstPressure : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMinConstPressure() - : SubscribeAttribute("min-const-pressure") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMinConstPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinConstPressureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxConstPressure - */ -class ReadPumpConfigurationAndControlMaxConstPressure : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxConstPressure() - : ReadAttribute("max-const-pressure") - { - } - - ~ReadPumpConfigurationAndControlMaxConstPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxConstPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxConstPressure read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxConstPressure : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxConstPressure() - : SubscribeAttribute("max-const-pressure") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxConstPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxConstPressureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinCompPressure - */ -class ReadPumpConfigurationAndControlMinCompPressure : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMinCompPressure() - : ReadAttribute("min-comp-pressure") - { - } - - ~ReadPumpConfigurationAndControlMinCompPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinCompPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MinCompPressure read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMinCompPressure : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMinCompPressure() - : SubscribeAttribute("min-comp-pressure") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMinCompPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinCompPressureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxCompPressure - */ -class ReadPumpConfigurationAndControlMaxCompPressure : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxCompPressure() - : ReadAttribute("max-comp-pressure") - { - } - - ~ReadPumpConfigurationAndControlMaxCompPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxCompPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxCompPressure read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxCompPressure : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxCompPressure() - : SubscribeAttribute("max-comp-pressure") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxCompPressure() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxCompPressureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinConstSpeed - */ -class ReadPumpConfigurationAndControlMinConstSpeed : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMinConstSpeed() - : ReadAttribute("min-const-speed") - { - } - - ~ReadPumpConfigurationAndControlMinConstSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinConstSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MinConstSpeed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMinConstSpeed : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMinConstSpeed() - : SubscribeAttribute("min-const-speed") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMinConstSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinConstSpeedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxConstSpeed - */ -class ReadPumpConfigurationAndControlMaxConstSpeed : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxConstSpeed() - : ReadAttribute("max-const-speed") - { - } - - ~ReadPumpConfigurationAndControlMaxConstSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxConstSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxConstSpeed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxConstSpeed : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() - : SubscribeAttribute("max-const-speed") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxConstSpeedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinConstFlow - */ -class ReadPumpConfigurationAndControlMinConstFlow : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMinConstFlow() - : ReadAttribute("min-const-flow") - { - } - - ~ReadPumpConfigurationAndControlMinConstFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinConstFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MinConstFlow read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMinConstFlow : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMinConstFlow() - : SubscribeAttribute("min-const-flow") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMinConstFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinConstFlowWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxConstFlow - */ -class ReadPumpConfigurationAndControlMaxConstFlow : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxConstFlow() - : ReadAttribute("max-const-flow") - { - } - - ~ReadPumpConfigurationAndControlMaxConstFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxConstFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxConstFlow read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxConstFlow : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxConstFlow() - : SubscribeAttribute("max-const-flow") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxConstFlow() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxConstFlowWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinConstTemp - */ -class ReadPumpConfigurationAndControlMinConstTemp : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMinConstTemp() - : ReadAttribute("min-const-temp") - { - } - - ~ReadPumpConfigurationAndControlMinConstTemp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinConstTempWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MinConstTemp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMinConstTemp : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMinConstTemp() - : SubscribeAttribute("min-const-temp") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMinConstTemp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinConstTempWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxConstTemp - */ -class ReadPumpConfigurationAndControlMaxConstTemp : public ReadAttribute { -public: - ReadPumpConfigurationAndControlMaxConstTemp() - : ReadAttribute("max-const-temp") - { - } - - ~ReadPumpConfigurationAndControlMaxConstTemp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxConstTempWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl MaxConstTemp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlMaxConstTemp : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlMaxConstTemp() - : SubscribeAttribute("max-const-temp") - { - } - - ~SubscribeAttributePumpConfigurationAndControlMaxConstTemp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxConstTempWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PumpStatus - */ -class ReadPumpConfigurationAndControlPumpStatus : public ReadAttribute { -public: - ReadPumpConfigurationAndControlPumpStatus() - : ReadAttribute("pump-status") - { - } - - ~ReadPumpConfigurationAndControlPumpStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePumpStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl PumpStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlPumpStatus : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlPumpStatus() - : SubscribeAttribute("pump-status") - { - } - - ~SubscribeAttributePumpConfigurationAndControlPumpStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePumpStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EffectiveOperationMode - */ -class ReadPumpConfigurationAndControlEffectiveOperationMode : public ReadAttribute { -public: - ReadPumpConfigurationAndControlEffectiveOperationMode() - : ReadAttribute("effective-operation-mode") - { - } - - ~ReadPumpConfigurationAndControlEffectiveOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEffectiveOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl EffectiveOperationMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() - : SubscribeAttribute("effective-operation-mode") - { - } - - ~SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEffectiveOperationModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EffectiveControlMode - */ -class ReadPumpConfigurationAndControlEffectiveControlMode : public ReadAttribute { -public: - ReadPumpConfigurationAndControlEffectiveControlMode() - : ReadAttribute("effective-control-mode") - { - } - - ~ReadPumpConfigurationAndControlEffectiveControlMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEffectiveControlModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl EffectiveControlMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlEffectiveControlMode : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() - : SubscribeAttribute("effective-control-mode") - { - } - - ~SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEffectiveControlModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Capacity - */ -class ReadPumpConfigurationAndControlCapacity : public ReadAttribute { -public: - ReadPumpConfigurationAndControlCapacity() - : ReadAttribute("capacity") - { - } - - ~ReadPumpConfigurationAndControlCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Capacity response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl Capacity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlCapacity : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlCapacity() - : SubscribeAttribute("capacity") - { - } - - ~SubscribeAttributePumpConfigurationAndControlCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCapacityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Capacity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Speed - */ -class ReadPumpConfigurationAndControlSpeed : public ReadAttribute { -public: - ReadPumpConfigurationAndControlSpeed() - : ReadAttribute("speed") - { - } - - ~ReadPumpConfigurationAndControlSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Speed response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl Speed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlSpeed : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlSpeed() - : SubscribeAttribute("speed") - { - } - - ~SubscribeAttributePumpConfigurationAndControlSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Speed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LifetimeRunningHours - */ -class ReadPumpConfigurationAndControlLifetimeRunningHours : public ReadAttribute { -public: - ReadPumpConfigurationAndControlLifetimeRunningHours() - : ReadAttribute("lifetime-running-hours") - { - } - - ~ReadPumpConfigurationAndControlLifetimeRunningHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLifetimeRunningHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl LifetimeRunningHours read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WritePumpConfigurationAndControlLifetimeRunningHours : public WriteAttribute { -public: - WritePumpConfigurationAndControlLifetimeRunningHours() - : WriteAttribute("lifetime-running-hours") - { - AddArgument("attr-name", "lifetime-running-hours"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WritePumpConfigurationAndControlLifetimeRunningHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) WriteAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeLifetimeRunningHoursWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("PumpConfigurationAndControl LifetimeRunningHours write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() - : SubscribeAttribute("lifetime-running-hours") - { - } - - ~SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLifetimeRunningHoursWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Power - */ -class ReadPumpConfigurationAndControlPower : public ReadAttribute { -public: - ReadPumpConfigurationAndControlPower() - : ReadAttribute("power") - { - } - - ~ReadPumpConfigurationAndControlPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Power response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl Power read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlPower : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlPower() - : SubscribeAttribute("power") - { - } - - ~SubscribeAttributePumpConfigurationAndControlPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.Power response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LifetimeEnergyConsumed - */ -class ReadPumpConfigurationAndControlLifetimeEnergyConsumed : public ReadAttribute { -public: - ReadPumpConfigurationAndControlLifetimeEnergyConsumed() - : ReadAttribute("lifetime-energy-consumed") - { - } - - ~ReadPumpConfigurationAndControlLifetimeEnergyConsumed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLifetimeEnergyConsumedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl LifetimeEnergyConsumed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WritePumpConfigurationAndControlLifetimeEnergyConsumed : public WriteAttribute { -public: - WritePumpConfigurationAndControlLifetimeEnergyConsumed() - : WriteAttribute("lifetime-energy-consumed") - { - AddArgument("attr-name", "lifetime-energy-consumed"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WritePumpConfigurationAndControlLifetimeEnergyConsumed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) WriteAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster - writeAttributeLifetimeEnergyConsumedWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "PumpConfigurationAndControl LifetimeEnergyConsumed write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() - : SubscribeAttribute("lifetime-energy-consumed") - { - } - - ~SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLifetimeEnergyConsumedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OperationMode - */ -class ReadPumpConfigurationAndControlOperationMode : public ReadAttribute { -public: - ReadPumpConfigurationAndControlOperationMode() - : ReadAttribute("operation-mode") - { - } - - ~ReadPumpConfigurationAndControlOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.OperationMode response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl OperationMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WritePumpConfigurationAndControlOperationMode : public WriteAttribute { -public: - WritePumpConfigurationAndControlOperationMode() - : WriteAttribute("operation-mode") - { - AddArgument("attr-name", "operation-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WritePumpConfigurationAndControlOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) WriteAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOperationModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("PumpConfigurationAndControl OperationMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributePumpConfigurationAndControlOperationMode : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlOperationMode() - : SubscribeAttribute("operation-mode") - { - } - - ~SubscribeAttributePumpConfigurationAndControlOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOperationModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.OperationMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ControlMode - */ -class ReadPumpConfigurationAndControlControlMode : public ReadAttribute { -public: - ReadPumpConfigurationAndControlControlMode() - : ReadAttribute("control-mode") - { - } - - ~ReadPumpConfigurationAndControlControlMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeControlModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.ControlMode response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl ControlMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WritePumpConfigurationAndControlControlMode : public WriteAttribute { -public: - WritePumpConfigurationAndControlControlMode() - : WriteAttribute("control-mode") - { - AddArgument("attr-name", "control-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WritePumpConfigurationAndControlControlMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) WriteAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeControlModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("PumpConfigurationAndControl ControlMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributePumpConfigurationAndControlControlMode : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlControlMode() - : SubscribeAttribute("control-mode") - { - } - - ~SubscribeAttributePumpConfigurationAndControlControlMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeControlModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.ControlMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadPumpConfigurationAndControlGeneratedCommandList : public ReadAttribute { -public: - ReadPumpConfigurationAndControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadPumpConfigurationAndControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadPumpConfigurationAndControlAcceptedCommandList : public ReadAttribute { -public: - ReadPumpConfigurationAndControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadPumpConfigurationAndControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadPumpConfigurationAndControlAttributeList : public ReadAttribute { -public: - ReadPumpConfigurationAndControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadPumpConfigurationAndControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlAttributeList : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributePumpConfigurationAndControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadPumpConfigurationAndControlFeatureMap : public ReadAttribute { -public: - ReadPumpConfigurationAndControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadPumpConfigurationAndControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributePumpConfigurationAndControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadPumpConfigurationAndControlClusterRevision : public ReadAttribute { -public: - ReadPumpConfigurationAndControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadPumpConfigurationAndControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("PumpConfigurationAndControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePumpConfigurationAndControlClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributePumpConfigurationAndControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributePumpConfigurationAndControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000200) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster Thermostat | 0x0201 | -|------------------------------------------------------------------------------| -| Commands: | | -| * SetpointRaiseLower | 0x00 | -| * SetWeeklySchedule | 0x01 | -| * GetWeeklySchedule | 0x02 | -| * ClearWeeklySchedule | 0x03 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * LocalTemperature | 0x0000 | -| * OutdoorTemperature | 0x0001 | -| * Occupancy | 0x0002 | -| * AbsMinHeatSetpointLimit | 0x0003 | -| * AbsMaxHeatSetpointLimit | 0x0004 | -| * AbsMinCoolSetpointLimit | 0x0005 | -| * AbsMaxCoolSetpointLimit | 0x0006 | -| * PICoolingDemand | 0x0007 | -| * PIHeatingDemand | 0x0008 | -| * HVACSystemTypeConfiguration | 0x0009 | -| * LocalTemperatureCalibration | 0x0010 | -| * OccupiedCoolingSetpoint | 0x0011 | -| * OccupiedHeatingSetpoint | 0x0012 | -| * UnoccupiedCoolingSetpoint | 0x0013 | -| * UnoccupiedHeatingSetpoint | 0x0014 | -| * MinHeatSetpointLimit | 0x0015 | -| * MaxHeatSetpointLimit | 0x0016 | -| * MinCoolSetpointLimit | 0x0017 | -| * MaxCoolSetpointLimit | 0x0018 | -| * MinSetpointDeadBand | 0x0019 | -| * RemoteSensing | 0x001A | -| * ControlSequenceOfOperation | 0x001B | -| * SystemMode | 0x001C | -| * ThermostatRunningMode | 0x001E | -| * StartOfWeek | 0x0020 | -| * NumberOfWeeklyTransitions | 0x0021 | -| * NumberOfDailyTransitions | 0x0022 | -| * TemperatureSetpointHold | 0x0023 | -| * TemperatureSetpointHoldDuration | 0x0024 | -| * ThermostatProgrammingOperationMode | 0x0025 | -| * ThermostatRunningState | 0x0029 | -| * SetpointChangeSource | 0x0030 | -| * SetpointChangeAmount | 0x0031 | -| * SetpointChangeSourceTimestamp | 0x0032 | -| * OccupiedSetback | 0x0034 | -| * OccupiedSetbackMin | 0x0035 | -| * OccupiedSetbackMax | 0x0036 | -| * UnoccupiedSetback | 0x0037 | -| * UnoccupiedSetbackMin | 0x0038 | -| * UnoccupiedSetbackMax | 0x0039 | -| * EmergencyHeatDelta | 0x003A | -| * ACType | 0x0040 | -| * ACCapacity | 0x0041 | -| * ACRefrigerantType | 0x0042 | -| * ACCompressorType | 0x0043 | -| * ACErrorCode | 0x0044 | -| * ACLouverPosition | 0x0045 | -| * ACCoilTemperature | 0x0046 | -| * ACCapacityformat | 0x0047 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command SetpointRaiseLower - */ -class ThermostatSetpointRaiseLower : public ClusterCommand { -public: - ThermostatSetpointRaiseLower() - : ClusterCommand("setpoint-raise-lower") - { - AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); - AddArgument("Amount", INT8_MIN, INT8_MAX, &mRequest.amount); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterSetpointRaiseLowerParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.mode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.mode)]; - params.amount = [NSNumber numberWithChar:mRequest.amount]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setpointRaiseLowerWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Type mRequest; -}; - -/* - * Command SetWeeklySchedule - */ -class ThermostatSetWeeklySchedule : public ClusterCommand { -public: - ThermostatSetWeeklySchedule() - : ClusterCommand("set-weekly-schedule") - , mComplex_Transitions(&mRequest.transitions) - { - AddArgument("NumberOfTransitionsForSequence", 0, UINT8_MAX, &mRequest.numberOfTransitionsForSequence); - AddArgument("DayOfWeekForSequence", 0, UINT8_MAX, &mRequest.dayOfWeekForSequence); - AddArgument("ModeForSequence", 0, UINT8_MAX, &mRequest.modeForSequence); - AddArgument("Transitions", &mComplex_Transitions); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterSetWeeklyScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.numberOfTransitionsForSequence = [NSNumber numberWithUnsignedChar:mRequest.numberOfTransitionsForSequence]; - params.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:mRequest.dayOfWeekForSequence.Raw()]; - params.modeForSequence = [NSNumber numberWithUnsignedChar:mRequest.modeForSequence.Raw()]; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.transitions) { - MTRThermostatClusterThermostatScheduleTransition * newElement_0; - newElement_0 = [MTRThermostatClusterThermostatScheduleTransition new]; - newElement_0.transitionTime = [NSNumber numberWithUnsignedShort:entry_0.transitionTime]; - if (entry_0.heatSetpoint.IsNull()) { - newElement_0.heatSetpoint = nil; - } else { - newElement_0.heatSetpoint = [NSNumber numberWithShort:entry_0.heatSetpoint.Value()]; - } - if (entry_0.coolSetpoint.IsNull()) { - newElement_0.coolSetpoint = nil; - } else { - newElement_0.coolSetpoint = [NSNumber numberWithShort:entry_0.coolSetpoint.Value()]; - } - [array_0 addObject:newElement_0]; - } - params.transitions = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setWeeklyScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type mRequest; - TypedComplexArgument< - chip::app::DataModel::List> - mComplex_Transitions; -}; - -/* - * Command GetWeeklySchedule - */ -class ThermostatGetWeeklySchedule : public ClusterCommand { -public: - ThermostatGetWeeklySchedule() - : ClusterCommand("get-weekly-schedule") - { - AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); - AddArgument("ModeToReturn", 0, UINT8_MAX, &mRequest.modeToReturn); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterGetWeeklyScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.daysToReturn = [NSNumber numberWithUnsignedChar:mRequest.daysToReturn.Raw()]; - params.modeToReturn = [NSNumber numberWithUnsignedChar:mRequest.modeToReturn.Raw()]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getWeeklyScheduleWithParams:params - completion:^(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type mRequest; -}; - -/* - * Command ClearWeeklySchedule - */ -class ThermostatClearWeeklySchedule : public ClusterCommand { -public: - ThermostatClearWeeklySchedule() - : ClusterCommand("clear-weekly-schedule") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterClearWeeklyScheduleParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster clearWeeklyScheduleWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Attribute LocalTemperature - */ -class ReadThermostatLocalTemperature : public ReadAttribute { -public: - ReadThermostatLocalTemperature() - : ReadAttribute("local-temperature") - { - } - - ~ReadThermostatLocalTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLocalTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.LocalTemperature response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat LocalTemperature read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatLocalTemperature : public SubscribeAttribute { -public: - SubscribeAttributeThermostatLocalTemperature() - : SubscribeAttribute("local-temperature") - { - } - - ~SubscribeAttributeThermostatLocalTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocalTemperatureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.LocalTemperature response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OutdoorTemperature - */ -class ReadThermostatOutdoorTemperature : public ReadAttribute { -public: - ReadThermostatOutdoorTemperature() - : ReadAttribute("outdoor-temperature") - { - } - - ~ReadThermostatOutdoorTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOutdoorTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OutdoorTemperature response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OutdoorTemperature read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatOutdoorTemperature : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOutdoorTemperature() - : SubscribeAttribute("outdoor-temperature") - { - } - - ~SubscribeAttributeThermostatOutdoorTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOutdoorTemperatureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OutdoorTemperature response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Occupancy - */ -class ReadThermostatOccupancy : public ReadAttribute { -public: - ReadThermostatOccupancy() - : ReadAttribute("occupancy") - { - } - - ~ReadThermostatOccupancy() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupancyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.Occupancy response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat Occupancy read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatOccupancy : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupancy() - : SubscribeAttribute("occupancy") - { - } - - ~SubscribeAttributeThermostatOccupancy() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupancyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.Occupancy response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AbsMinHeatSetpointLimit - */ -class ReadThermostatAbsMinHeatSetpointLimit : public ReadAttribute { -public: - ReadThermostatAbsMinHeatSetpointLimit() - : ReadAttribute("abs-min-heat-setpoint-limit") - { - } - - ~ReadThermostatAbsMinHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AbsMinHeatSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAbsMinHeatSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAbsMinHeatSetpointLimit() - : SubscribeAttribute("abs-min-heat-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatAbsMinHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAbsMinHeatSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AbsMaxHeatSetpointLimit - */ -class ReadThermostatAbsMaxHeatSetpointLimit : public ReadAttribute { -public: - ReadThermostatAbsMaxHeatSetpointLimit() - : ReadAttribute("abs-max-heat-setpoint-limit") - { - } - - ~ReadThermostatAbsMaxHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AbsMaxHeatSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAbsMaxHeatSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() - : SubscribeAttribute("abs-max-heat-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAbsMaxHeatSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AbsMinCoolSetpointLimit - */ -class ReadThermostatAbsMinCoolSetpointLimit : public ReadAttribute { -public: - ReadThermostatAbsMinCoolSetpointLimit() - : ReadAttribute("abs-min-cool-setpoint-limit") - { - } - - ~ReadThermostatAbsMinCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AbsMinCoolSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAbsMinCoolSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAbsMinCoolSetpointLimit() - : SubscribeAttribute("abs-min-cool-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatAbsMinCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAbsMinCoolSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AbsMaxCoolSetpointLimit - */ -class ReadThermostatAbsMaxCoolSetpointLimit : public ReadAttribute { -public: - ReadThermostatAbsMaxCoolSetpointLimit() - : ReadAttribute("abs-max-cool-setpoint-limit") - { - } - - ~ReadThermostatAbsMaxCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AbsMaxCoolSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAbsMaxCoolSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() - : SubscribeAttribute("abs-max-cool-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAbsMaxCoolSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PICoolingDemand - */ -class ReadThermostatPICoolingDemand : public ReadAttribute { -public: - ReadThermostatPICoolingDemand() - : ReadAttribute("picooling-demand") - { - } - - ~ReadThermostatPICoolingDemand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePICoolingDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat PICoolingDemand read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatPICoolingDemand : public SubscribeAttribute { -public: - SubscribeAttributeThermostatPICoolingDemand() - : SubscribeAttribute("picooling-demand") - { - } - - ~SubscribeAttributeThermostatPICoolingDemand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePICoolingDemandWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PIHeatingDemand - */ -class ReadThermostatPIHeatingDemand : public ReadAttribute { -public: - ReadThermostatPIHeatingDemand() - : ReadAttribute("piheating-demand") - { - } - - ~ReadThermostatPIHeatingDemand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePIHeatingDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat PIHeatingDemand read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatPIHeatingDemand : public SubscribeAttribute { -public: - SubscribeAttributeThermostatPIHeatingDemand() - : SubscribeAttribute("piheating-demand") - { - } - - ~SubscribeAttributeThermostatPIHeatingDemand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePIHeatingDemandWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute HVACSystemTypeConfiguration - */ -class ReadThermostatHVACSystemTypeConfiguration : public ReadAttribute { -public: - ReadThermostatHVACSystemTypeConfiguration() - : ReadAttribute("hvacsystem-type-configuration") - { - } - - ~ReadThermostatHVACSystemTypeConfiguration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHVACSystemTypeConfigurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat HVACSystemTypeConfiguration read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatHVACSystemTypeConfiguration : public WriteAttribute { -public: - WriteThermostatHVACSystemTypeConfiguration() - : WriteAttribute("hvacsystem-type-configuration") - { - AddArgument("attr-name", "hvacsystem-type-configuration"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatHVACSystemTypeConfiguration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeHVACSystemTypeConfigurationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat HVACSystemTypeConfiguration write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatHVACSystemTypeConfiguration : public SubscribeAttribute { -public: - SubscribeAttributeThermostatHVACSystemTypeConfiguration() - : SubscribeAttribute("hvacsystem-type-configuration") - { - } - - ~SubscribeAttributeThermostatHVACSystemTypeConfiguration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeHVACSystemTypeConfigurationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LocalTemperatureCalibration - */ -class ReadThermostatLocalTemperatureCalibration : public ReadAttribute { -public: - ReadThermostatLocalTemperatureCalibration() - : ReadAttribute("local-temperature-calibration") - { - } - - ~ReadThermostatLocalTemperatureCalibration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLocalTemperatureCalibrationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.LocalTemperatureCalibration response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat LocalTemperatureCalibration read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatLocalTemperatureCalibration : public WriteAttribute { -public: - WriteThermostatLocalTemperatureCalibration() - : WriteAttribute("local-temperature-calibration") - { - AddArgument("attr-name", "local-temperature-calibration"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatLocalTemperatureCalibration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; - - [cluster - writeAttributeLocalTemperatureCalibrationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat LocalTemperatureCalibration write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int8_t mValue; -}; - -class SubscribeAttributeThermostatLocalTemperatureCalibration : public SubscribeAttribute { -public: - SubscribeAttributeThermostatLocalTemperatureCalibration() - : SubscribeAttribute("local-temperature-calibration") - { - } - - ~SubscribeAttributeThermostatLocalTemperatureCalibration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLocalTemperatureCalibrationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.LocalTemperatureCalibration response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupiedCoolingSetpoint - */ -class ReadThermostatOccupiedCoolingSetpoint : public ReadAttribute { -public: - ReadThermostatOccupiedCoolingSetpoint() - : ReadAttribute("occupied-cooling-setpoint") - { - } - - ~ReadThermostatOccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupiedCoolingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OccupiedCoolingSetpoint read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatOccupiedCoolingSetpoint : public WriteAttribute { -public: - WriteThermostatOccupiedCoolingSetpoint() - : WriteAttribute("occupied-cooling-setpoint") - { - AddArgument("attr-name", "occupied-cooling-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatOccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeOccupiedCoolingSetpointWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat OccupiedCoolingSetpoint write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatOccupiedCoolingSetpoint : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupiedCoolingSetpoint() - : SubscribeAttribute("occupied-cooling-setpoint") - { - } - - ~SubscribeAttributeThermostatOccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupiedCoolingSetpointWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupiedHeatingSetpoint - */ -class ReadThermostatOccupiedHeatingSetpoint : public ReadAttribute { -public: - ReadThermostatOccupiedHeatingSetpoint() - : ReadAttribute("occupied-heating-setpoint") - { - } - - ~ReadThermostatOccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupiedHeatingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OccupiedHeatingSetpoint read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatOccupiedHeatingSetpoint : public WriteAttribute { -public: - WriteThermostatOccupiedHeatingSetpoint() - : WriteAttribute("occupied-heating-setpoint") - { - AddArgument("attr-name", "occupied-heating-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatOccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeOccupiedHeatingSetpointWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat OccupiedHeatingSetpoint write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatOccupiedHeatingSetpoint : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupiedHeatingSetpoint() - : SubscribeAttribute("occupied-heating-setpoint") - { - } - - ~SubscribeAttributeThermostatOccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupiedHeatingSetpointWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UnoccupiedCoolingSetpoint - */ -class ReadThermostatUnoccupiedCoolingSetpoint : public ReadAttribute { -public: - ReadThermostatUnoccupiedCoolingSetpoint() - : ReadAttribute("unoccupied-cooling-setpoint") - { - } - - ~ReadThermostatUnoccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnoccupiedCoolingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat UnoccupiedCoolingSetpoint read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUnoccupiedCoolingSetpoint : public WriteAttribute { -public: - WriteThermostatUnoccupiedCoolingSetpoint() - : WriteAttribute("unoccupied-cooling-setpoint") - { - AddArgument("attr-name", "unoccupied-cooling-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUnoccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster - writeAttributeUnoccupiedCoolingSetpointWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat UnoccupiedCoolingSetpoint write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatUnoccupiedCoolingSetpoint : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() - : SubscribeAttribute("unoccupied-cooling-setpoint") - { - } - - ~SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUnoccupiedCoolingSetpointWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UnoccupiedHeatingSetpoint - */ -class ReadThermostatUnoccupiedHeatingSetpoint : public ReadAttribute { -public: - ReadThermostatUnoccupiedHeatingSetpoint() - : ReadAttribute("unoccupied-heating-setpoint") - { - } - - ~ReadThermostatUnoccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnoccupiedHeatingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat UnoccupiedHeatingSetpoint read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUnoccupiedHeatingSetpoint : public WriteAttribute { -public: - WriteThermostatUnoccupiedHeatingSetpoint() - : WriteAttribute("unoccupied-heating-setpoint") - { - AddArgument("attr-name", "unoccupied-heating-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUnoccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster - writeAttributeUnoccupiedHeatingSetpointWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat UnoccupiedHeatingSetpoint write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatUnoccupiedHeatingSetpoint : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() - : SubscribeAttribute("unoccupied-heating-setpoint") - { - } - - ~SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUnoccupiedHeatingSetpointWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinHeatSetpointLimit - */ -class ReadThermostatMinHeatSetpointLimit : public ReadAttribute { -public: - ReadThermostatMinHeatSetpointLimit() - : ReadAttribute("min-heat-setpoint-limit") - { - } - - ~ReadThermostatMinHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinHeatSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat MinHeatSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatMinHeatSetpointLimit : public WriteAttribute { -public: - WriteThermostatMinHeatSetpointLimit() - : WriteAttribute("min-heat-setpoint-limit") - { - AddArgument("attr-name", "min-heat-setpoint-limit"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatMinHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeMinHeatSetpointLimitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat MinHeatSetpointLimit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatMinHeatSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatMinHeatSetpointLimit() - : SubscribeAttribute("min-heat-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatMinHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinHeatSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxHeatSetpointLimit - */ -class ReadThermostatMaxHeatSetpointLimit : public ReadAttribute { -public: - ReadThermostatMaxHeatSetpointLimit() - : ReadAttribute("max-heat-setpoint-limit") - { - } - - ~ReadThermostatMaxHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat MaxHeatSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatMaxHeatSetpointLimit : public WriteAttribute { -public: - WriteThermostatMaxHeatSetpointLimit() - : WriteAttribute("max-heat-setpoint-limit") - { - AddArgument("attr-name", "max-heat-setpoint-limit"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatMaxHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeMaxHeatSetpointLimitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat MaxHeatSetpointLimit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatMaxHeatSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatMaxHeatSetpointLimit() - : SubscribeAttribute("max-heat-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatMaxHeatSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxHeatSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinCoolSetpointLimit - */ -class ReadThermostatMinCoolSetpointLimit : public ReadAttribute { -public: - ReadThermostatMinCoolSetpointLimit() - : ReadAttribute("min-cool-setpoint-limit") - { - } - - ~ReadThermostatMinCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinCoolSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat MinCoolSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatMinCoolSetpointLimit : public WriteAttribute { -public: - WriteThermostatMinCoolSetpointLimit() - : WriteAttribute("min-cool-setpoint-limit") - { - AddArgument("attr-name", "min-cool-setpoint-limit"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatMinCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeMinCoolSetpointLimitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat MinCoolSetpointLimit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatMinCoolSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatMinCoolSetpointLimit() - : SubscribeAttribute("min-cool-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatMinCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinCoolSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxCoolSetpointLimit - */ -class ReadThermostatMaxCoolSetpointLimit : public ReadAttribute { -public: - ReadThermostatMaxCoolSetpointLimit() - : ReadAttribute("max-cool-setpoint-limit") - { - } - - ~ReadThermostatMaxCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000018) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat MaxCoolSetpointLimit read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatMaxCoolSetpointLimit : public WriteAttribute { -public: - WriteThermostatMaxCoolSetpointLimit() - : WriteAttribute("max-cool-setpoint-limit") - { - AddArgument("attr-name", "max-cool-setpoint-limit"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatMaxCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeMaxCoolSetpointLimitWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat MaxCoolSetpointLimit write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int16_t mValue; -}; - -class SubscribeAttributeThermostatMaxCoolSetpointLimit : public SubscribeAttribute { -public: - SubscribeAttributeThermostatMaxCoolSetpointLimit() - : SubscribeAttribute("max-cool-setpoint-limit") - { - } - - ~SubscribeAttributeThermostatMaxCoolSetpointLimit() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxCoolSetpointLimitWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinSetpointDeadBand - */ -class ReadThermostatMinSetpointDeadBand : public ReadAttribute { -public: - ReadThermostatMinSetpointDeadBand() - : ReadAttribute("min-setpoint-dead-band") - { - } - - ~ReadThermostatMinSetpointDeadBand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinSetpointDeadBandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat MinSetpointDeadBand read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatMinSetpointDeadBand : public WriteAttribute { -public: - WriteThermostatMinSetpointDeadBand() - : WriteAttribute("min-setpoint-dead-band") - { - AddArgument("attr-name", "min-setpoint-dead-band"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatMinSetpointDeadBand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; - - [cluster writeAttributeMinSetpointDeadBandWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat MinSetpointDeadBand write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - int8_t mValue; -}; - -class SubscribeAttributeThermostatMinSetpointDeadBand : public SubscribeAttribute { -public: - SubscribeAttributeThermostatMinSetpointDeadBand() - : SubscribeAttribute("min-setpoint-dead-band") - { - } - - ~SubscribeAttributeThermostatMinSetpointDeadBand() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinSetpointDeadBandWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute RemoteSensing - */ -class ReadThermostatRemoteSensing : public ReadAttribute { -public: - ReadThermostatRemoteSensing() - : ReadAttribute("remote-sensing") - { - } - - ~ReadThermostatRemoteSensing() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRemoteSensingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.RemoteSensing response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat RemoteSensing read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatRemoteSensing : public WriteAttribute { -public: - WriteThermostatRemoteSensing() - : WriteAttribute("remote-sensing") - { - AddArgument("attr-name", "remote-sensing"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatRemoteSensing() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeRemoteSensingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat RemoteSensing write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatRemoteSensing : public SubscribeAttribute { -public: - SubscribeAttributeThermostatRemoteSensing() - : SubscribeAttribute("remote-sensing") - { - } - - ~SubscribeAttributeThermostatRemoteSensing() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRemoteSensingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.RemoteSensing response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ControlSequenceOfOperation - */ -class ReadThermostatControlSequenceOfOperation : public ReadAttribute { -public: - ReadThermostatControlSequenceOfOperation() - : ReadAttribute("control-sequence-of-operation") - { - } - - ~ReadThermostatControlSequenceOfOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeControlSequenceOfOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ControlSequenceOfOperation response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ControlSequenceOfOperation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatControlSequenceOfOperation : public WriteAttribute { -public: - WriteThermostatControlSequenceOfOperation() - : WriteAttribute("control-sequence-of-operation") - { - AddArgument("attr-name", "control-sequence-of-operation"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatControlSequenceOfOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeControlSequenceOfOperationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ControlSequenceOfOperation write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatControlSequenceOfOperation : public SubscribeAttribute { -public: - SubscribeAttributeThermostatControlSequenceOfOperation() - : SubscribeAttribute("control-sequence-of-operation") - { - } - - ~SubscribeAttributeThermostatControlSequenceOfOperation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeControlSequenceOfOperationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ControlSequenceOfOperation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SystemMode - */ -class ReadThermostatSystemMode : public ReadAttribute { -public: - ReadThermostatSystemMode() - : ReadAttribute("system-mode") - { - } - - ~ReadThermostatSystemMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000001C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSystemModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SystemMode response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat SystemMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatSystemMode : public WriteAttribute { -public: - WriteThermostatSystemMode() - : WriteAttribute("system-mode") - { - AddArgument("attr-name", "system-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatSystemMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSystemModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat SystemMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatSystemMode : public SubscribeAttribute { -public: - SubscribeAttributeThermostatSystemMode() - : SubscribeAttribute("system-mode") - { - } - - ~SubscribeAttributeThermostatSystemMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSystemModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SystemMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ThermostatRunningMode - */ -class ReadThermostatThermostatRunningMode : public ReadAttribute { -public: - ReadThermostatThermostatRunningMode() - : ReadAttribute("thermostat-running-mode") - { - } - - ~ReadThermostatThermostatRunningMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000001E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeThermostatRunningModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatRunningMode response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ThermostatRunningMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatThermostatRunningMode : public SubscribeAttribute { -public: - SubscribeAttributeThermostatThermostatRunningMode() - : SubscribeAttribute("thermostat-running-mode") - { - } - - ~SubscribeAttributeThermostatThermostatRunningMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000001E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeThermostatRunningModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatRunningMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute StartOfWeek - */ -class ReadThermostatStartOfWeek : public ReadAttribute { -public: - ReadThermostatStartOfWeek() - : ReadAttribute("start-of-week") - { - } - - ~ReadThermostatStartOfWeek() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStartOfWeekWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.StartOfWeek response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat StartOfWeek read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatStartOfWeek : public SubscribeAttribute { -public: - SubscribeAttributeThermostatStartOfWeek() - : SubscribeAttribute("start-of-week") - { - } - - ~SubscribeAttributeThermostatStartOfWeek() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStartOfWeekWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.StartOfWeek response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute NumberOfWeeklyTransitions - */ -class ReadThermostatNumberOfWeeklyTransitions : public ReadAttribute { -public: - ReadThermostatNumberOfWeeklyTransitions() - : ReadAttribute("number-of-weekly-transitions") - { - } - - ~ReadThermostatNumberOfWeeklyTransitions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNumberOfWeeklyTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat NumberOfWeeklyTransitions read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatNumberOfWeeklyTransitions : public SubscribeAttribute { -public: - SubscribeAttributeThermostatNumberOfWeeklyTransitions() - : SubscribeAttribute("number-of-weekly-transitions") - { - } - - ~SubscribeAttributeThermostatNumberOfWeeklyTransitions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfWeeklyTransitionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute NumberOfDailyTransitions - */ -class ReadThermostatNumberOfDailyTransitions : public ReadAttribute { -public: - ReadThermostatNumberOfDailyTransitions() - : ReadAttribute("number-of-daily-transitions") - { - } - - ~ReadThermostatNumberOfDailyTransitions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000022) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNumberOfDailyTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.NumberOfDailyTransitions response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat NumberOfDailyTransitions read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatNumberOfDailyTransitions : public SubscribeAttribute { -public: - SubscribeAttributeThermostatNumberOfDailyTransitions() - : SubscribeAttribute("number-of-daily-transitions") - { - } - - ~SubscribeAttributeThermostatNumberOfDailyTransitions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfDailyTransitionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.NumberOfDailyTransitions response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute TemperatureSetpointHold - */ -class ReadThermostatTemperatureSetpointHold : public ReadAttribute { -public: - ReadThermostatTemperatureSetpointHold() - : ReadAttribute("temperature-setpoint-hold") - { - } - - ~ReadThermostatTemperatureSetpointHold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000023) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTemperatureSetpointHoldWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHold response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat TemperatureSetpointHold read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatTemperatureSetpointHold : public WriteAttribute { -public: - WriteThermostatTemperatureSetpointHold() - : WriteAttribute("temperature-setpoint-hold") - { - AddArgument("attr-name", "temperature-setpoint-hold"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatTemperatureSetpointHold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeTemperatureSetpointHoldWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat TemperatureSetpointHold write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatTemperatureSetpointHold : public SubscribeAttribute { -public: - SubscribeAttributeThermostatTemperatureSetpointHold() - : SubscribeAttribute("temperature-setpoint-hold") - { - } - - ~SubscribeAttributeThermostatTemperatureSetpointHold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTemperatureSetpointHoldWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHold response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute TemperatureSetpointHoldDuration - */ -class ReadThermostatTemperatureSetpointHoldDuration : public ReadAttribute { -public: - ReadThermostatTemperatureSetpointHoldDuration() - : ReadAttribute("temperature-setpoint-hold-duration") - { - } - - ~ReadThermostatTemperatureSetpointHoldDuration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeTemperatureSetpointHoldDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat TemperatureSetpointHoldDuration read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatTemperatureSetpointHoldDuration : public WriteAttribute { -public: - WriteThermostatTemperatureSetpointHoldDuration() - : WriteAttribute("temperature-setpoint-hold-duration") - { - AddArgument("attr-name", "temperature-setpoint-hold-duration"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatTemperatureSetpointHoldDuration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeTemperatureSetpointHoldDurationWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat TemperatureSetpointHoldDuration write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeThermostatTemperatureSetpointHoldDuration : public SubscribeAttribute { -public: - SubscribeAttributeThermostatTemperatureSetpointHoldDuration() - : SubscribeAttribute("temperature-setpoint-hold-duration") - { - } - - ~SubscribeAttributeThermostatTemperatureSetpointHoldDuration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTemperatureSetpointHoldDurationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ThermostatProgrammingOperationMode - */ -class ReadThermostatThermostatProgrammingOperationMode : public ReadAttribute { -public: - ReadThermostatThermostatProgrammingOperationMode() - : ReadAttribute("thermostat-programming-operation-mode") - { - } - - ~ReadThermostatThermostatProgrammingOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeThermostatProgrammingOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ThermostatProgrammingOperationMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatThermostatProgrammingOperationMode : public WriteAttribute { -public: - WriteThermostatThermostatProgrammingOperationMode() - : WriteAttribute("thermostat-programming-operation-mode") - { - AddArgument("attr-name", "thermostat-programming-operation-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatThermostatProgrammingOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeThermostatProgrammingOperationModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "Thermostat ThermostatProgrammingOperationMode write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatThermostatProgrammingOperationMode : public SubscribeAttribute { -public: - SubscribeAttributeThermostatThermostatProgrammingOperationMode() - : SubscribeAttribute("thermostat-programming-operation-mode") - { - } - - ~SubscribeAttributeThermostatThermostatProgrammingOperationMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeThermostatProgrammingOperationModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ThermostatRunningState - */ -class ReadThermostatThermostatRunningState : public ReadAttribute { -public: - ReadThermostatThermostatRunningState() - : ReadAttribute("thermostat-running-state") - { - } - - ~ReadThermostatThermostatRunningState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000029) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeThermostatRunningStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatRunningState response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ThermostatRunningState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatThermostatRunningState : public SubscribeAttribute { -public: - SubscribeAttributeThermostatThermostatRunningState() - : SubscribeAttribute("thermostat-running-state") - { - } - - ~SubscribeAttributeThermostatThermostatRunningState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeThermostatRunningStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ThermostatRunningState response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SetpointChangeSource - */ -class ReadThermostatSetpointChangeSource : public ReadAttribute { -public: - ReadThermostatSetpointChangeSource() - : ReadAttribute("setpoint-change-source") - { - } - - ~ReadThermostatSetpointChangeSource() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSetpointChangeSourceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeSource response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat SetpointChangeSource read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatSetpointChangeSource : public SubscribeAttribute { -public: - SubscribeAttributeThermostatSetpointChangeSource() - : SubscribeAttribute("setpoint-change-source") - { - } - - ~SubscribeAttributeThermostatSetpointChangeSource() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSetpointChangeSourceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeSource response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SetpointChangeAmount - */ -class ReadThermostatSetpointChangeAmount : public ReadAttribute { -public: - ReadThermostatSetpointChangeAmount() - : ReadAttribute("setpoint-change-amount") - { - } - - ~ReadThermostatSetpointChangeAmount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSetpointChangeAmountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeAmount response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat SetpointChangeAmount read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatSetpointChangeAmount : public SubscribeAttribute { -public: - SubscribeAttributeThermostatSetpointChangeAmount() - : SubscribeAttribute("setpoint-change-amount") - { - } - - ~SubscribeAttributeThermostatSetpointChangeAmount() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSetpointChangeAmountWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeAmount response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SetpointChangeSourceTimestamp - */ -class ReadThermostatSetpointChangeSourceTimestamp : public ReadAttribute { -public: - ReadThermostatSetpointChangeSourceTimestamp() - : ReadAttribute("setpoint-change-source-timestamp") - { - } - - ~ReadThermostatSetpointChangeSourceTimestamp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSetpointChangeSourceTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat SetpointChangeSourceTimestamp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatSetpointChangeSourceTimestamp : public SubscribeAttribute { -public: - SubscribeAttributeThermostatSetpointChangeSourceTimestamp() - : SubscribeAttribute("setpoint-change-source-timestamp") - { - } - - ~SubscribeAttributeThermostatSetpointChangeSourceTimestamp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSetpointChangeSourceTimestampWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupiedSetback - */ -class ReadThermostatOccupiedSetback : public ReadAttribute { -public: - ReadThermostatOccupiedSetback() - : ReadAttribute("occupied-setback") - { - } - - ~ReadThermostatOccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000034) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupiedSetbackWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OccupiedSetback read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatOccupiedSetback : public WriteAttribute { -public: - WriteThermostatOccupiedSetback() - : WriteAttribute("occupied-setback") - { - AddArgument("attr-name", "occupied-setback"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatOccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOccupiedSetbackWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat OccupiedSetback write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatOccupiedSetback : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupiedSetback() - : SubscribeAttribute("occupied-setback") - { - } - - ~SubscribeAttributeThermostatOccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupiedSetbackWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupiedSetbackMin - */ -class ReadThermostatOccupiedSetbackMin : public ReadAttribute { -public: - ReadThermostatOccupiedSetbackMin() - : ReadAttribute("occupied-setback-min") - { - } - - ~ReadThermostatOccupiedSetbackMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000035) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupiedSetbackMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetbackMin response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OccupiedSetbackMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatOccupiedSetbackMin : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupiedSetbackMin() - : SubscribeAttribute("occupied-setback-min") - { - } - - ~SubscribeAttributeThermostatOccupiedSetbackMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupiedSetbackMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetbackMin response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupiedSetbackMax - */ -class ReadThermostatOccupiedSetbackMax : public ReadAttribute { -public: - ReadThermostatOccupiedSetbackMax() - : ReadAttribute("occupied-setback-max") - { - } - - ~ReadThermostatOccupiedSetbackMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000036) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupiedSetbackMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetbackMax response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat OccupiedSetbackMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatOccupiedSetbackMax : public SubscribeAttribute { -public: - SubscribeAttributeThermostatOccupiedSetbackMax() - : SubscribeAttribute("occupied-setback-max") - { - } - - ~SubscribeAttributeThermostatOccupiedSetbackMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000036) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupiedSetbackMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.OccupiedSetbackMax response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UnoccupiedSetback - */ -class ReadThermostatUnoccupiedSetback : public ReadAttribute { -public: - ReadThermostatUnoccupiedSetback() - : ReadAttribute("unoccupied-setback") - { - } - - ~ReadThermostatUnoccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000037) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnoccupiedSetbackWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetback response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat UnoccupiedSetback read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUnoccupiedSetback : public WriteAttribute { -public: - WriteThermostatUnoccupiedSetback() - : WriteAttribute("unoccupied-setback") - { - AddArgument("attr-name", "unoccupied-setback"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUnoccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000037) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeUnoccupiedSetbackWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat UnoccupiedSetback write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatUnoccupiedSetback : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUnoccupiedSetback() - : SubscribeAttribute("unoccupied-setback") - { - } - - ~SubscribeAttributeThermostatUnoccupiedSetback() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000037) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUnoccupiedSetbackWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetback response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UnoccupiedSetbackMin - */ -class ReadThermostatUnoccupiedSetbackMin : public ReadAttribute { -public: - ReadThermostatUnoccupiedSetbackMin() - : ReadAttribute("unoccupied-setback-min") - { - } - - ~ReadThermostatUnoccupiedSetbackMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000038) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnoccupiedSetbackMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat UnoccupiedSetbackMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUnoccupiedSetbackMin : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUnoccupiedSetbackMin() - : SubscribeAttribute("unoccupied-setback-min") - { - } - - ~SubscribeAttributeThermostatUnoccupiedSetbackMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000038) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUnoccupiedSetbackMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UnoccupiedSetbackMax - */ -class ReadThermostatUnoccupiedSetbackMax : public ReadAttribute { -public: - ReadThermostatUnoccupiedSetbackMax() - : ReadAttribute("unoccupied-setback-max") - { - } - - ~ReadThermostatUnoccupiedSetbackMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000039) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnoccupiedSetbackMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat UnoccupiedSetbackMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUnoccupiedSetbackMax : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUnoccupiedSetbackMax() - : SubscribeAttribute("unoccupied-setback-max") - { - } - - ~SubscribeAttributeThermostatUnoccupiedSetbackMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000039) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUnoccupiedSetbackMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EmergencyHeatDelta - */ -class ReadThermostatEmergencyHeatDelta : public ReadAttribute { -public: - ReadThermostatEmergencyHeatDelta() - : ReadAttribute("emergency-heat-delta") - { - } - - ~ReadThermostatEmergencyHeatDelta() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000003A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEmergencyHeatDeltaWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.EmergencyHeatDelta response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat EmergencyHeatDelta read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatEmergencyHeatDelta : public WriteAttribute { -public: - WriteThermostatEmergencyHeatDelta() - : WriteAttribute("emergency-heat-delta") - { - AddArgument("attr-name", "emergency-heat-delta"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatEmergencyHeatDelta() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x0000003A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeEmergencyHeatDeltaWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat EmergencyHeatDelta write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatEmergencyHeatDelta : public SubscribeAttribute { -public: - SubscribeAttributeThermostatEmergencyHeatDelta() - : SubscribeAttribute("emergency-heat-delta") - { - } - - ~SubscribeAttributeThermostatEmergencyHeatDelta() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000003A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEmergencyHeatDeltaWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.EmergencyHeatDelta response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACType - */ -class ReadThermostatACType : public ReadAttribute { -public: - ReadThermostatACType() - : ReadAttribute("actype") - { - } - - ~ReadThermostatACType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000040) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACType response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACType : public WriteAttribute { -public: - WriteThermostatACType() - : WriteAttribute("actype") - { - AddArgument("attr-name", "actype"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000040) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeACTypeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACType write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatACType : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACType() - : SubscribeAttribute("actype") - { - } - - ~SubscribeAttributeThermostatACType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000040) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACCapacity - */ -class ReadThermostatACCapacity : public ReadAttribute { -public: - ReadThermostatACCapacity() - : ReadAttribute("accapacity") - { - } - - ~ReadThermostatACCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000041) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacity response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACCapacity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACCapacity : public WriteAttribute { -public: - WriteThermostatACCapacity() - : WriteAttribute("accapacity") - { - AddArgument("attr-name", "accapacity"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000041) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeACCapacityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACCapacity write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeThermostatACCapacity : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACCapacity() - : SubscribeAttribute("accapacity") - { - } - - ~SubscribeAttributeThermostatACCapacity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000041) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACCapacityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACRefrigerantType - */ -class ReadThermostatACRefrigerantType : public ReadAttribute { -public: - ReadThermostatACRefrigerantType() - : ReadAttribute("acrefrigerant-type") - { - } - - ~ReadThermostatACRefrigerantType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000042) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACRefrigerantTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACRefrigerantType response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACRefrigerantType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACRefrigerantType : public WriteAttribute { -public: - WriteThermostatACRefrigerantType() - : WriteAttribute("acrefrigerant-type") - { - AddArgument("attr-name", "acrefrigerant-type"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACRefrigerantType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000042) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeACRefrigerantTypeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACRefrigerantType write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatACRefrigerantType : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACRefrigerantType() - : SubscribeAttribute("acrefrigerant-type") - { - } - - ~SubscribeAttributeThermostatACRefrigerantType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000042) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACRefrigerantTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACRefrigerantType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACCompressorType - */ -class ReadThermostatACCompressorType : public ReadAttribute { -public: - ReadThermostatACCompressorType() - : ReadAttribute("accompressor-type") - { - } - - ~ReadThermostatACCompressorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000043) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACCompressorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCompressorType response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACCompressorType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACCompressorType : public WriteAttribute { -public: - WriteThermostatACCompressorType() - : WriteAttribute("accompressor-type") - { - AddArgument("attr-name", "accompressor-type"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACCompressorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000043) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeACCompressorTypeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACCompressorType write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatACCompressorType : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACCompressorType() - : SubscribeAttribute("accompressor-type") - { - } - - ~SubscribeAttributeThermostatACCompressorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000043) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACCompressorTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCompressorType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACErrorCode - */ -class ReadThermostatACErrorCode : public ReadAttribute { -public: - ReadThermostatACErrorCode() - : ReadAttribute("acerror-code") - { - } - - ~ReadThermostatACErrorCode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000044) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACErrorCodeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACErrorCode response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACErrorCode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACErrorCode : public WriteAttribute { -public: - WriteThermostatACErrorCode() - : WriteAttribute("acerror-code") - { - AddArgument("attr-name", "acerror-code"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACErrorCode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000044) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeACErrorCodeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACErrorCode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeThermostatACErrorCode : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACErrorCode() - : SubscribeAttribute("acerror-code") - { - } - - ~SubscribeAttributeThermostatACErrorCode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000044) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACErrorCodeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACErrorCode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACLouverPosition - */ -class ReadThermostatACLouverPosition : public ReadAttribute { -public: - ReadThermostatACLouverPosition() - : ReadAttribute("aclouver-position") - { - } - - ~ReadThermostatACLouverPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000045) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACLouverPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACLouverPosition response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACLouverPosition read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACLouverPosition : public WriteAttribute { -public: - WriteThermostatACLouverPosition() - : WriteAttribute("aclouver-position") - { - AddArgument("attr-name", "aclouver-position"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACLouverPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000045) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeACLouverPositionWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACLouverPosition write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatACLouverPosition : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACLouverPosition() - : SubscribeAttribute("aclouver-position") - { - } - - ~SubscribeAttributeThermostatACLouverPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000045) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACLouverPositionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACLouverPosition response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACCoilTemperature - */ -class ReadThermostatACCoilTemperature : public ReadAttribute { -public: - ReadThermostatACCoilTemperature() - : ReadAttribute("accoil-temperature") - { - } - - ~ReadThermostatACCoilTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000046) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACCoilTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCoilTemperature response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACCoilTemperature read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatACCoilTemperature : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACCoilTemperature() - : SubscribeAttribute("accoil-temperature") - { - } - - ~SubscribeAttributeThermostatACCoilTemperature() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000046) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACCoilTemperatureWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCoilTemperature response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ACCapacityformat - */ -class ReadThermostatACCapacityformat : public ReadAttribute { -public: - ReadThermostatACCapacityformat() - : ReadAttribute("accapacityformat") - { - } - - ~ReadThermostatACCapacityformat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x00000047) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeACCapacityformatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ACCapacityformat read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatACCapacityformat : public WriteAttribute { -public: - WriteThermostatACCapacityformat() - : WriteAttribute("accapacityformat") - { - AddArgument("attr-name", "accapacityformat"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatACCapacityformat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) WriteAttribute (0x00000047) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeACCapacityformatWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("Thermostat ACCapacityformat write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { -public: - SubscribeAttributeThermostatACCapacityformat() - : SubscribeAttribute("accapacityformat") - { - } - - ~SubscribeAttributeThermostatACCapacityformat() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x00000047) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeACCapacityformatWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadThermostatGeneratedCommandList : public ReadAttribute { -public: - ReadThermostatGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadThermostatGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeThermostatGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadThermostatAcceptedCommandList : public ReadAttribute { -public: - ReadThermostatAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadThermostatAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeThermostatAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadThermostatAttributeList : public ReadAttribute { -public: - ReadThermostatAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadThermostatAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeThermostatAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadThermostatFeatureMap : public ReadAttribute { -public: - ReadThermostatFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadThermostatFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeThermostatFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeThermostatFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadThermostatClusterRevision : public ReadAttribute { -public: - ReadThermostatClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadThermostatClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Thermostat ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeThermostatClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeThermostatClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000201) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster FanControl | 0x0202 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * FanMode | 0x0000 | -| * FanModeSequence | 0x0001 | -| * PercentSetting | 0x0002 | -| * PercentCurrent | 0x0003 | -| * SpeedMax | 0x0004 | -| * SpeedSetting | 0x0005 | -| * SpeedCurrent | 0x0006 | -| * RockSupport | 0x0007 | -| * RockSetting | 0x0008 | -| * WindSupport | 0x0009 | -| * WindSetting | 0x000A | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute FanMode - */ -class ReadFanControlFanMode : public ReadAttribute { -public: - ReadFanControlFanMode() - : ReadAttribute("fan-mode") - { - } - - ~ReadFanControlFanMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FanMode response %@", [value description]); - if (error != nil) { - LogNSError("FanControl FanMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlFanMode : public WriteAttribute { -public: - WriteFanControlFanMode() - : WriteAttribute("fan-mode") - { - AddArgument("attr-name", "fan-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlFanMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeFanModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl FanMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlFanMode : public SubscribeAttribute { -public: - SubscribeAttributeFanControlFanMode() - : SubscribeAttribute("fan-mode") - { - } - - ~SubscribeAttributeFanControlFanMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFanModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FanMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FanModeSequence - */ -class ReadFanControlFanModeSequence : public ReadAttribute { -public: - ReadFanControlFanModeSequence() - : ReadAttribute("fan-mode-sequence") - { - } - - ~ReadFanControlFanModeSequence() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFanModeSequenceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FanModeSequence response %@", [value description]); - if (error != nil) { - LogNSError("FanControl FanModeSequence read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlFanModeSequence : public WriteAttribute { -public: - WriteFanControlFanModeSequence() - : WriteAttribute("fan-mode-sequence") - { - AddArgument("attr-name", "fan-mode-sequence"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlFanModeSequence() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeFanModeSequenceWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl FanModeSequence write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlFanModeSequence : public SubscribeAttribute { -public: - SubscribeAttributeFanControlFanModeSequence() - : SubscribeAttribute("fan-mode-sequence") - { - } - - ~SubscribeAttributeFanControlFanModeSequence() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFanModeSequenceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FanModeSequence response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PercentSetting - */ -class ReadFanControlPercentSetting : public ReadAttribute { -public: - ReadFanControlPercentSetting() - : ReadAttribute("percent-setting") - { - } - - ~ReadFanControlPercentSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.PercentSetting response %@", [value description]); - if (error != nil) { - LogNSError("FanControl PercentSetting read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlPercentSetting : public WriteAttribute { -public: - WriteFanControlPercentSetting() - : WriteAttribute("percent-setting") - { - AddArgument("attr-name", "percent-setting"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlPercentSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributePercentSettingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl PercentSetting write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlPercentSetting : public SubscribeAttribute { -public: - SubscribeAttributeFanControlPercentSetting() - : SubscribeAttribute("percent-setting") - { - } - - ~SubscribeAttributeFanControlPercentSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePercentSettingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.PercentSetting response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PercentCurrent - */ -class ReadFanControlPercentCurrent : public ReadAttribute { -public: - ReadFanControlPercentCurrent() - : ReadAttribute("percent-current") - { - } - - ~ReadFanControlPercentCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.PercentCurrent response %@", [value description]); - if (error != nil) { - LogNSError("FanControl PercentCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlPercentCurrent : public SubscribeAttribute { -public: - SubscribeAttributeFanControlPercentCurrent() - : SubscribeAttribute("percent-current") - { - } - - ~SubscribeAttributeFanControlPercentCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePercentCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.PercentCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SpeedMax - */ -class ReadFanControlSpeedMax : public ReadAttribute { -public: - ReadFanControlSpeedMax() - : ReadAttribute("speed-max") - { - } - - ~ReadFanControlSpeedMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedMax response %@", [value description]); - if (error != nil) { - LogNSError("FanControl SpeedMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlSpeedMax : public SubscribeAttribute { -public: - SubscribeAttributeFanControlSpeedMax() - : SubscribeAttribute("speed-max") - { - } - - ~SubscribeAttributeFanControlSpeedMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeedMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedMax response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SpeedSetting - */ -class ReadFanControlSpeedSetting : public ReadAttribute { -public: - ReadFanControlSpeedSetting() - : ReadAttribute("speed-setting") - { - } - - ~ReadFanControlSpeedSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedSetting response %@", [value description]); - if (error != nil) { - LogNSError("FanControl SpeedSetting read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlSpeedSetting : public WriteAttribute { -public: - WriteFanControlSpeedSetting() - : WriteAttribute("speed-setting") - { - AddArgument("attr-name", "speed-setting"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlSpeedSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSpeedSettingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl SpeedSetting write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlSpeedSetting : public SubscribeAttribute { -public: - SubscribeAttributeFanControlSpeedSetting() - : SubscribeAttribute("speed-setting") - { - } - - ~SubscribeAttributeFanControlSpeedSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeedSettingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedSetting response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SpeedCurrent - */ -class ReadFanControlSpeedCurrent : public ReadAttribute { -public: - ReadFanControlSpeedCurrent() - : ReadAttribute("speed-current") - { - } - - ~ReadFanControlSpeedCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedCurrent response %@", [value description]); - if (error != nil) { - LogNSError("FanControl SpeedCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlSpeedCurrent : public SubscribeAttribute { -public: - SubscribeAttributeFanControlSpeedCurrent() - : SubscribeAttribute("speed-current") - { - } - - ~SubscribeAttributeFanControlSpeedCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeedCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.SpeedCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute RockSupport - */ -class ReadFanControlRockSupport : public ReadAttribute { -public: - ReadFanControlRockSupport() - : ReadAttribute("rock-support") - { - } - - ~ReadFanControlRockSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRockSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.RockSupport response %@", [value description]); - if (error != nil) { - LogNSError("FanControl RockSupport read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlRockSupport : public SubscribeAttribute { -public: - SubscribeAttributeFanControlRockSupport() - : SubscribeAttribute("rock-support") - { - } - - ~SubscribeAttributeFanControlRockSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRockSupportWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.RockSupport response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute RockSetting - */ -class ReadFanControlRockSetting : public ReadAttribute { -public: - ReadFanControlRockSetting() - : ReadAttribute("rock-setting") - { - } - - ~ReadFanControlRockSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRockSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.RockSetting response %@", [value description]); - if (error != nil) { - LogNSError("FanControl RockSetting read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlRockSetting : public WriteAttribute { -public: - WriteFanControlRockSetting() - : WriteAttribute("rock-setting") - { - AddArgument("attr-name", "rock-setting"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlRockSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeRockSettingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl RockSetting write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlRockSetting : public SubscribeAttribute { -public: - SubscribeAttributeFanControlRockSetting() - : SubscribeAttribute("rock-setting") - { - } - - ~SubscribeAttributeFanControlRockSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRockSettingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.RockSetting response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute WindSupport - */ -class ReadFanControlWindSupport : public ReadAttribute { -public: - ReadFanControlWindSupport() - : ReadAttribute("wind-support") - { - } - - ~ReadFanControlWindSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWindSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.WindSupport response %@", [value description]); - if (error != nil) { - LogNSError("FanControl WindSupport read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlWindSupport : public SubscribeAttribute { -public: - SubscribeAttributeFanControlWindSupport() - : SubscribeAttribute("wind-support") - { - } - - ~SubscribeAttributeFanControlWindSupport() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWindSupportWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.WindSupport response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute WindSetting - */ -class ReadFanControlWindSetting : public ReadAttribute { -public: - ReadFanControlWindSetting() - : ReadAttribute("wind-setting") - { - } - - ~ReadFanControlWindSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.WindSetting response %@", [value description]); - if (error != nil) { - LogNSError("FanControl WindSetting read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteFanControlWindSetting : public WriteAttribute { -public: - WriteFanControlWindSetting() - : WriteAttribute("wind-setting") - { - AddArgument("attr-name", "wind-setting"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteFanControlWindSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) WriteAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeWindSettingWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("FanControl WindSetting write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeFanControlWindSetting : public SubscribeAttribute { -public: - SubscribeAttributeFanControlWindSetting() - : SubscribeAttribute("wind-setting") - { - } - - ~SubscribeAttributeFanControlWindSetting() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWindSettingWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.WindSetting response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadFanControlGeneratedCommandList : public ReadAttribute { -public: - ReadFanControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadFanControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FanControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeFanControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeFanControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadFanControlAcceptedCommandList : public ReadAttribute { -public: - ReadFanControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadFanControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FanControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeFanControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeFanControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadFanControlAttributeList : public ReadAttribute { -public: - ReadFanControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadFanControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("FanControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeFanControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeFanControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadFanControlFeatureMap : public ReadAttribute { -public: - ReadFanControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadFanControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("FanControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeFanControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeFanControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadFanControlClusterRevision : public ReadAttribute { -public: - ReadFanControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadFanControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("FanControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFanControlClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeFanControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeFanControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000202) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FanControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ThermostatUserInterfaceConfiguration | 0x0204 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * TemperatureDisplayMode | 0x0000 | -| * KeypadLockout | 0x0001 | -| * ScheduleProgrammingVisibility | 0x0002 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute TemperatureDisplayMode - */ -class ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() - : ReadAttribute("temperature-display-mode") - { - } - - ~ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTemperatureDisplayModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration TemperatureDisplayMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode : public WriteAttribute { -public: - WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() - : WriteAttribute("temperature-display-mode") - { - AddArgument("attr-name", "temperature-display-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeTemperatureDisplayModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration " - "TemperatureDisplayMode write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() - : SubscribeAttribute("temperature-display-mode") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTemperatureDisplayModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute KeypadLockout - */ -class ReadThermostatUserInterfaceConfigurationKeypadLockout : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationKeypadLockout() - : ReadAttribute("keypad-lockout") - { - } - - ~ReadThermostatUserInterfaceConfigurationKeypadLockout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeKeypadLockoutWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration KeypadLockout read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUserInterfaceConfigurationKeypadLockout : public WriteAttribute { -public: - WriteThermostatUserInterfaceConfigurationKeypadLockout() - : WriteAttribute("keypad-lockout") - { - AddArgument("attr-name", "keypad-lockout"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUserInterfaceConfigurationKeypadLockout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeKeypadLockoutWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration KeypadLockout write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() - : SubscribeAttribute("keypad-lockout") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeKeypadLockoutWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ScheduleProgrammingVisibility - */ -class ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() - : ReadAttribute("schedule-programming-visibility") - { - } - - ~ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeScheduleProgrammingVisibilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration ScheduleProgrammingVisibility read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public WriteAttribute { -public: - WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() - : WriteAttribute("schedule-programming-visibility") - { - AddArgument("attr-name", "schedule-programming-visibility"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) WriteAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeScheduleProgrammingVisibilityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration " - "ScheduleProgrammingVisibility write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() - : SubscribeAttribute("schedule-programming-visibility") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeScheduleProgrammingVisibilityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadThermostatUserInterfaceConfigurationGeneratedCommandList : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadThermostatUserInterfaceConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadThermostatUserInterfaceConfigurationAcceptedCommandList : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadThermostatUserInterfaceConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadThermostatUserInterfaceConfigurationAttributeList : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadThermostatUserInterfaceConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadThermostatUserInterfaceConfigurationFeatureMap : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadThermostatUserInterfaceConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadThermostatUserInterfaceConfigurationClusterRevision : public ReadAttribute { -public: - ReadThermostatUserInterfaceConfigurationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadThermostatUserInterfaceConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ThermostatUserInterfaceConfiguration ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000204) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ColorControl | 0x0300 | -|------------------------------------------------------------------------------| -| Commands: | | -| * MoveToHue | 0x00 | -| * MoveHue | 0x01 | -| * StepHue | 0x02 | -| * MoveToSaturation | 0x03 | -| * MoveSaturation | 0x04 | -| * StepSaturation | 0x05 | -| * MoveToHueAndSaturation | 0x06 | -| * MoveToColor | 0x07 | -| * MoveColor | 0x08 | -| * StepColor | 0x09 | -| * MoveToColorTemperature | 0x0A | -| * EnhancedMoveToHue | 0x40 | -| * EnhancedMoveHue | 0x41 | -| * EnhancedStepHue | 0x42 | -| * EnhancedMoveToHueAndSaturation | 0x43 | -| * ColorLoopSet | 0x44 | -| * StopMoveStep | 0x47 | -| * MoveColorTemperature | 0x4B | -| * StepColorTemperature | 0x4C | -|------------------------------------------------------------------------------| -| Attributes: | | -| * CurrentHue | 0x0000 | -| * CurrentSaturation | 0x0001 | -| * RemainingTime | 0x0002 | -| * CurrentX | 0x0003 | -| * CurrentY | 0x0004 | -| * DriftCompensation | 0x0005 | -| * CompensationText | 0x0006 | -| * ColorTemperatureMireds | 0x0007 | -| * ColorMode | 0x0008 | -| * Options | 0x000F | -| * NumberOfPrimaries | 0x0010 | -| * Primary1X | 0x0011 | -| * Primary1Y | 0x0012 | -| * Primary1Intensity | 0x0013 | -| * Primary2X | 0x0015 | -| * Primary2Y | 0x0016 | -| * Primary2Intensity | 0x0017 | -| * Primary3X | 0x0019 | -| * Primary3Y | 0x001A | -| * Primary3Intensity | 0x001B | -| * Primary4X | 0x0020 | -| * Primary4Y | 0x0021 | -| * Primary4Intensity | 0x0022 | -| * Primary5X | 0x0024 | -| * Primary5Y | 0x0025 | -| * Primary5Intensity | 0x0026 | -| * Primary6X | 0x0028 | -| * Primary6Y | 0x0029 | -| * Primary6Intensity | 0x002A | -| * WhitePointX | 0x0030 | -| * WhitePointY | 0x0031 | -| * ColorPointRX | 0x0032 | -| * ColorPointRY | 0x0033 | -| * ColorPointRIntensity | 0x0034 | -| * ColorPointGX | 0x0036 | -| * ColorPointGY | 0x0037 | -| * ColorPointGIntensity | 0x0038 | -| * ColorPointBX | 0x003A | -| * ColorPointBY | 0x003B | -| * ColorPointBIntensity | 0x003C | -| * EnhancedCurrentHue | 0x4000 | -| * EnhancedColorMode | 0x4001 | -| * ColorLoopActive | 0x4002 | -| * ColorLoopDirection | 0x4003 | -| * ColorLoopTime | 0x4004 | -| * ColorLoopStartEnhancedHue | 0x4005 | -| * ColorLoopStoredEnhancedHue | 0x4006 | -| * ColorCapabilities | 0x400A | -| * ColorTempPhysicalMinMireds | 0x400B | -| * ColorTempPhysicalMaxMireds | 0x400C | -| * CoupleColorTempToLevelMinMireds | 0x400D | -| * StartUpColorTemperatureMireds | 0x4010 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command MoveToHue - */ -class ColorControlMoveToHue : public ClusterCommand { -public: - ColorControlMoveToHue() - : ClusterCommand("move-to-hue") - { - AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); - AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveToHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; - params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type mRequest; -}; - -/* - * Command MoveHue - */ -class ColorControlMoveHue : public ClusterCommand { -public: - ColorControlMoveHue() - : ClusterCommand("move-hue") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveHue::Type mRequest; -}; - -/* - * Command StepHue - */ -class ColorControlStepHue : public ClusterCommand { -public: - ColorControlStepHue() - : ClusterCommand("step-hue") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterStepHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; - params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::StepHue::Type mRequest; -}; - -/* - * Command MoveToSaturation - */ -class ColorControlMoveToSaturation : public ClusterCommand { -public: - ColorControlMoveToSaturation() - : ClusterCommand("move-to-saturation") - { - AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveToSaturationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToSaturationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type mRequest; -}; - -/* - * Command MoveSaturation - */ -class ColorControlMoveSaturation : public ClusterCommand { -public: - ColorControlMoveSaturation() - : ClusterCommand("move-saturation") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveSaturationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveSaturationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type mRequest; -}; - -/* - * Command StepSaturation - */ -class ColorControlStepSaturation : public ClusterCommand { -public: - ColorControlStepSaturation() - : ClusterCommand("step-saturation") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterStepSaturationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; - params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepSaturationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type mRequest; -}; - -/* - * Command MoveToHueAndSaturation - */ -class ColorControlMoveToHueAndSaturation : public ClusterCommand { -public: - ColorControlMoveToHueAndSaturation() - : ClusterCommand("move-to-hue-and-saturation") - { - AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); - AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveToHueAndSaturationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; - params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToHueAndSaturationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type mRequest; -}; - -/* - * Command MoveToColor - */ -class ColorControlMoveToColor : public ClusterCommand { -public: - ColorControlMoveToColor() - : ClusterCommand("move-to-color") - { - AddArgument("ColorX", 0, UINT16_MAX, &mRequest.colorX); - AddArgument("ColorY", 0, UINT16_MAX, &mRequest.colorY); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveToColorParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.colorX = [NSNumber numberWithUnsignedShort:mRequest.colorX]; - params.colorY = [NSNumber numberWithUnsignedShort:mRequest.colorY]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToColorWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type mRequest; -}; - -/* - * Command MoveColor - */ -class ColorControlMoveColor : public ClusterCommand { -public: - ColorControlMoveColor() - : ClusterCommand("move-color") - { - AddArgument("RateX", INT16_MIN, INT16_MAX, &mRequest.rateX); - AddArgument("RateY", INT16_MIN, INT16_MAX, &mRequest.rateY); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveColorParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.rateX = [NSNumber numberWithShort:mRequest.rateX]; - params.rateY = [NSNumber numberWithShort:mRequest.rateY]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveColorWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveColor::Type mRequest; -}; - -/* - * Command StepColor - */ -class ColorControlStepColor : public ClusterCommand { -public: - ColorControlStepColor() - : ClusterCommand("step-color") - { - AddArgument("StepX", INT16_MIN, INT16_MAX, &mRequest.stepX); - AddArgument("StepY", INT16_MIN, INT16_MAX, &mRequest.stepY); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterStepColorParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepX = [NSNumber numberWithShort:mRequest.stepX]; - params.stepY = [NSNumber numberWithShort:mRequest.stepY]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepColorWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::StepColor::Type mRequest; -}; - -/* - * Command MoveToColorTemperature - */ -class ColorControlMoveToColorTemperature : public ClusterCommand { -public: - ColorControlMoveToColorTemperature() - : ClusterCommand("move-to-color-temperature") - { - AddArgument("ColorTemperature", 0, UINT16_MAX, &mRequest.colorTemperature); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveToColorTemperatureParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.colorTemperature = [NSNumber numberWithUnsignedShort:mRequest.colorTemperature]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveToColorTemperatureWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type mRequest; -}; - -/* - * Command EnhancedMoveToHue - */ -class ColorControlEnhancedMoveToHue : public ClusterCommand { -public: - ColorControlEnhancedMoveToHue() - : ClusterCommand("enhanced-move-to-hue") - { - AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); - AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000040) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; - params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedMoveToHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type mRequest; -}; - -/* - * Command EnhancedMoveHue - */ -class ColorControlEnhancedMoveHue : public ClusterCommand { -public: - ColorControlEnhancedMoveHue() - : ClusterCommand("enhanced-move-hue") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000041) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterEnhancedMoveHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedMoveHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type mRequest; -}; - -/* - * Command EnhancedStepHue - */ -class ColorControlEnhancedStepHue : public ClusterCommand { -public: - ColorControlEnhancedStepHue() - : ClusterCommand("enhanced-step-hue") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000042) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterEnhancedStepHueParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedStepHueWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type mRequest; -}; - -/* - * Command EnhancedMoveToHueAndSaturation - */ -class ColorControlEnhancedMoveToHueAndSaturation : public ClusterCommand { -public: - ColorControlEnhancedMoveToHueAndSaturation() - : ClusterCommand("enhanced-move-to-hue-and-saturation") - { - AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); - AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000043) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueAndSaturationParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; - params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster enhancedMoveToHueAndSaturationWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type mRequest; -}; - -/* - * Command ColorLoopSet - */ -class ColorControlColorLoopSet : public ClusterCommand { -public: - ColorControlColorLoopSet() - : ClusterCommand("color-loop-set") - { - AddArgument("UpdateFlags", 0, UINT8_MAX, &mRequest.updateFlags); - AddArgument("Action", 0, UINT8_MAX, &mRequest.action); - AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); - AddArgument("Time", 0, UINT16_MAX, &mRequest.time); - AddArgument("StartHue", 0, UINT16_MAX, &mRequest.startHue); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000044) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.updateFlags = [NSNumber numberWithUnsignedChar:mRequest.updateFlags.Raw()]; - params.action = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.action)]; - params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; - params.time = [NSNumber numberWithUnsignedShort:mRequest.time]; - params.startHue = [NSNumber numberWithUnsignedShort:mRequest.startHue]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster colorLoopSetWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type mRequest; -}; - -/* - * Command StopMoveStep - */ -class ColorControlStopMoveStep : public ClusterCommand { -public: - ColorControlStopMoveStep() - : ClusterCommand("stop-move-step") - { - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x00000047) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterStopMoveStepParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopMoveStepWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type mRequest; -}; - -/* - * Command MoveColorTemperature - */ -class ColorControlMoveColorTemperature : public ClusterCommand { -public: - ColorControlMoveColorTemperature() - : ClusterCommand("move-color-temperature") - { - AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); - AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); - AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMinimumMireds); - AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMaximumMireds); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x0000004B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterMoveColorTemperatureParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; - params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; - params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; - params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster moveColorTemperatureWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type mRequest; -}; - -/* - * Command StepColorTemperature - */ -class ColorControlStepColorTemperature : public ClusterCommand { -public: - ColorControlStepColorTemperature() - : ClusterCommand("step-color-temperature") - { - AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); - AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); - AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMinimumMireds); - AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMaximumMireds); - AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); - AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) command (0x0000004C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRColorControlClusterStepColorTemperatureParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; - params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; - params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; - params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stepColorTemperatureWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type mRequest; -}; - -/* - * Attribute CurrentHue - */ -class ReadColorControlCurrentHue : public ReadAttribute { -public: - ReadColorControlCurrentHue() - : ReadAttribute("current-hue") - { - } - - ~ReadColorControlCurrentHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentHue response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CurrentHue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCurrentHue : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCurrentHue() - : SubscribeAttribute("current-hue") - { - } - - ~SubscribeAttributeColorControlCurrentHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentHueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentHue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentSaturation - */ -class ReadColorControlCurrentSaturation : public ReadAttribute { -public: - ReadColorControlCurrentSaturation() - : ReadAttribute("current-saturation") - { - } - - ~ReadColorControlCurrentSaturation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentSaturationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CurrentSaturation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCurrentSaturation : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCurrentSaturation() - : SubscribeAttribute("current-saturation") - { - } - - ~SubscribeAttributeColorControlCurrentSaturation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentSaturationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute RemainingTime - */ -class ReadColorControlRemainingTime : public ReadAttribute { -public: - ReadColorControlRemainingTime() - : ReadAttribute("remaining-time") - { - } - - ~ReadColorControlRemainingTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRemainingTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.RemainingTime response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl RemainingTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlRemainingTime : public SubscribeAttribute { -public: - SubscribeAttributeColorControlRemainingTime() - : SubscribeAttribute("remaining-time") - { - } - - ~SubscribeAttributeColorControlRemainingTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRemainingTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.RemainingTime response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentX - */ -class ReadColorControlCurrentX : public ReadAttribute { -public: - ReadColorControlCurrentX() - : ReadAttribute("current-x") - { - } - - ~ReadColorControlCurrentX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentX response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CurrentX read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCurrentX : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCurrentX() - : SubscribeAttribute("current-x") - { - } - - ~SubscribeAttributeColorControlCurrentX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentXWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentX response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentY - */ -class ReadColorControlCurrentY : public ReadAttribute { -public: - ReadColorControlCurrentY() - : ReadAttribute("current-y") - { - } - - ~ReadColorControlCurrentY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentY response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CurrentY read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCurrentY : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCurrentY() - : SubscribeAttribute("current-y") - { - } - - ~SubscribeAttributeColorControlCurrentY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentYWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CurrentY response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute DriftCompensation - */ -class ReadColorControlDriftCompensation : public ReadAttribute { -public: - ReadColorControlDriftCompensation() - : ReadAttribute("drift-compensation") - { - } - - ~ReadColorControlDriftCompensation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDriftCompensationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.DriftCompensation response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl DriftCompensation read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlDriftCompensation : public SubscribeAttribute { -public: - SubscribeAttributeColorControlDriftCompensation() - : SubscribeAttribute("drift-compensation") - { - } - - ~SubscribeAttributeColorControlDriftCompensation() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDriftCompensationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.DriftCompensation response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CompensationText - */ -class ReadColorControlCompensationText : public ReadAttribute { -public: - ReadColorControlCompensationText() - : ReadAttribute("compensation-text") - { - } - - ~ReadColorControlCompensationText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCompensationTextWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CompensationText response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CompensationText read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCompensationText : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCompensationText() - : SubscribeAttribute("compensation-text") - { - } - - ~SubscribeAttributeColorControlCompensationText() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCompensationTextWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CompensationText response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorTemperatureMireds - */ -class ReadColorControlColorTemperatureMireds : public ReadAttribute { -public: - ReadColorControlColorTemperatureMireds() - : ReadAttribute("color-temperature-mireds") - { - } - - ~ReadColorControlColorTemperatureMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorTemperatureMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTemperatureMireds response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorTemperatureMireds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorTemperatureMireds : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorTemperatureMireds() - : SubscribeAttribute("color-temperature-mireds") - { - } - - ~SubscribeAttributeColorControlColorTemperatureMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorTemperatureMiredsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTemperatureMireds response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorMode - */ -class ReadColorControlColorMode : public ReadAttribute { -public: - ReadColorControlColorMode() - : ReadAttribute("color-mode") - { - } - - ~ReadColorControlColorMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorMode response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorMode : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorMode() - : SubscribeAttribute("color-mode") - { - } - - ~SubscribeAttributeColorControlColorMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Options - */ -class ReadColorControlOptions : public ReadAttribute { -public: - ReadColorControlOptions() - : ReadAttribute("options") - { - } - - ~ReadColorControlOptions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOptionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Options response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Options read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlOptions : public WriteAttribute { -public: - WriteColorControlOptions() - : WriteAttribute("options") - { - AddArgument("attr-name", "options"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlOptions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOptionsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl Options write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeColorControlOptions : public SubscribeAttribute { -public: - SubscribeAttributeColorControlOptions() - : SubscribeAttribute("options") - { - } - - ~SubscribeAttributeColorControlOptions() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOptionsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Options response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute NumberOfPrimaries - */ -class ReadColorControlNumberOfPrimaries : public ReadAttribute { -public: - ReadColorControlNumberOfPrimaries() - : ReadAttribute("number-of-primaries") - { - } - - ~ReadColorControlNumberOfPrimaries() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNumberOfPrimariesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl NumberOfPrimaries read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlNumberOfPrimaries : public SubscribeAttribute { -public: - SubscribeAttributeColorControlNumberOfPrimaries() - : SubscribeAttribute("number-of-primaries") - { - } - - ~SubscribeAttributeColorControlNumberOfPrimaries() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNumberOfPrimariesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary1X - */ -class ReadColorControlPrimary1X : public ReadAttribute { -public: - ReadColorControlPrimary1X() - : ReadAttribute("primary1x") - { - } - - ~ReadColorControlPrimary1X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary1XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary1X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary1X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary1X() - : SubscribeAttribute("primary1x") - { - } - - ~SubscribeAttributeColorControlPrimary1X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary1XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary1Y - */ -class ReadColorControlPrimary1Y : public ReadAttribute { -public: - ReadColorControlPrimary1Y() - : ReadAttribute("primary1y") - { - } - - ~ReadColorControlPrimary1Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary1YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary1Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary1Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary1Y() - : SubscribeAttribute("primary1y") - { - } - - ~SubscribeAttributeColorControlPrimary1Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary1YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary1Intensity - */ -class ReadColorControlPrimary1Intensity : public ReadAttribute { -public: - ReadColorControlPrimary1Intensity() - : ReadAttribute("primary1intensity") - { - } - - ~ReadColorControlPrimary1Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary1IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary1Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary1Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary1Intensity() - : SubscribeAttribute("primary1intensity") - { - } - - ~SubscribeAttributeColorControlPrimary1Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary1IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary2X - */ -class ReadColorControlPrimary2X : public ReadAttribute { -public: - ReadColorControlPrimary2X() - : ReadAttribute("primary2x") - { - } - - ~ReadColorControlPrimary2X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary2XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary2X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary2X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary2X() - : SubscribeAttribute("primary2x") - { - } - - ~SubscribeAttributeColorControlPrimary2X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary2XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary2Y - */ -class ReadColorControlPrimary2Y : public ReadAttribute { -public: - ReadColorControlPrimary2Y() - : ReadAttribute("primary2y") - { - } - - ~ReadColorControlPrimary2Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary2YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary2Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary2Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary2Y() - : SubscribeAttribute("primary2y") - { - } - - ~SubscribeAttributeColorControlPrimary2Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary2YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary2Intensity - */ -class ReadColorControlPrimary2Intensity : public ReadAttribute { -public: - ReadColorControlPrimary2Intensity() - : ReadAttribute("primary2intensity") - { - } - - ~ReadColorControlPrimary2Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary2IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary2Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary2Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary2Intensity() - : SubscribeAttribute("primary2intensity") - { - } - - ~SubscribeAttributeColorControlPrimary2Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary2IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary3X - */ -class ReadColorControlPrimary3X : public ReadAttribute { -public: - ReadColorControlPrimary3X() - : ReadAttribute("primary3x") - { - } - - ~ReadColorControlPrimary3X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary3XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary3X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary3X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary3X() - : SubscribeAttribute("primary3x") - { - } - - ~SubscribeAttributeColorControlPrimary3X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary3XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary3Y - */ -class ReadColorControlPrimary3Y : public ReadAttribute { -public: - ReadColorControlPrimary3Y() - : ReadAttribute("primary3y") - { - } - - ~ReadColorControlPrimary3Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary3YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary3Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary3Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary3Y() - : SubscribeAttribute("primary3y") - { - } - - ~SubscribeAttributeColorControlPrimary3Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary3YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary3Intensity - */ -class ReadColorControlPrimary3Intensity : public ReadAttribute { -public: - ReadColorControlPrimary3Intensity() - : ReadAttribute("primary3intensity") - { - } - - ~ReadColorControlPrimary3Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary3IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary3Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary3Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary3Intensity() - : SubscribeAttribute("primary3intensity") - { - } - - ~SubscribeAttributeColorControlPrimary3Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary3IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary4X - */ -class ReadColorControlPrimary4X : public ReadAttribute { -public: - ReadColorControlPrimary4X() - : ReadAttribute("primary4x") - { - } - - ~ReadColorControlPrimary4X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary4XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary4X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary4X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary4X() - : SubscribeAttribute("primary4x") - { - } - - ~SubscribeAttributeColorControlPrimary4X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary4XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary4Y - */ -class ReadColorControlPrimary4Y : public ReadAttribute { -public: - ReadColorControlPrimary4Y() - : ReadAttribute("primary4y") - { - } - - ~ReadColorControlPrimary4Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary4YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary4Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary4Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary4Y() - : SubscribeAttribute("primary4y") - { - } - - ~SubscribeAttributeColorControlPrimary4Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary4YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary4Intensity - */ -class ReadColorControlPrimary4Intensity : public ReadAttribute { -public: - ReadColorControlPrimary4Intensity() - : ReadAttribute("primary4intensity") - { - } - - ~ReadColorControlPrimary4Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000022) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary4IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary4Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary4Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary4Intensity() - : SubscribeAttribute("primary4intensity") - { - } - - ~SubscribeAttributeColorControlPrimary4Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary4IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary5X - */ -class ReadColorControlPrimary5X : public ReadAttribute { -public: - ReadColorControlPrimary5X() - : ReadAttribute("primary5x") - { - } - - ~ReadColorControlPrimary5X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary5XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary5X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary5X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary5X() - : SubscribeAttribute("primary5x") - { - } - - ~SubscribeAttributeColorControlPrimary5X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary5XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary5Y - */ -class ReadColorControlPrimary5Y : public ReadAttribute { -public: - ReadColorControlPrimary5Y() - : ReadAttribute("primary5y") - { - } - - ~ReadColorControlPrimary5Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary5YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary5Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary5Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary5Y() - : SubscribeAttribute("primary5y") - { - } - - ~SubscribeAttributeColorControlPrimary5Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary5YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary5Intensity - */ -class ReadColorControlPrimary5Intensity : public ReadAttribute { -public: - ReadColorControlPrimary5Intensity() - : ReadAttribute("primary5intensity") - { - } - - ~ReadColorControlPrimary5Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary5IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary5Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary5Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary5Intensity() - : SubscribeAttribute("primary5intensity") - { - } - - ~SubscribeAttributeColorControlPrimary5Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary5IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary6X - */ -class ReadColorControlPrimary6X : public ReadAttribute { -public: - ReadColorControlPrimary6X() - : ReadAttribute("primary6x") - { - } - - ~ReadColorControlPrimary6X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000028) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary6XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6X response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary6X read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary6X : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary6X() - : SubscribeAttribute("primary6x") - { - } - - ~SubscribeAttributeColorControlPrimary6X() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary6XWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6X response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary6Y - */ -class ReadColorControlPrimary6Y : public ReadAttribute { -public: - ReadColorControlPrimary6Y() - : ReadAttribute("primary6y") - { - } - - ~ReadColorControlPrimary6Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000029) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary6YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6Y response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary6Y read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary6Y : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary6Y() - : SubscribeAttribute("primary6y") - { - } - - ~SubscribeAttributeColorControlPrimary6Y() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary6YWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6Y response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Primary6Intensity - */ -class ReadColorControlPrimary6Intensity : public ReadAttribute { -public: - ReadColorControlPrimary6Intensity() - : ReadAttribute("primary6intensity") - { - } - - ~ReadColorControlPrimary6Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000002A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePrimary6IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl Primary6Intensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlPrimary6Intensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlPrimary6Intensity() - : SubscribeAttribute("primary6intensity") - { - } - - ~SubscribeAttributeColorControlPrimary6Intensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePrimary6IntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute WhitePointX - */ -class ReadColorControlWhitePointX : public ReadAttribute { -public: - ReadColorControlWhitePointX() - : ReadAttribute("white-point-x") - { - } - - ~ReadColorControlWhitePointX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWhitePointXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.WhitePointX response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl WhitePointX read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlWhitePointX : public WriteAttribute { -public: - WriteColorControlWhitePointX() - : WriteAttribute("white-point-x") - { - AddArgument("attr-name", "white-point-x"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlWhitePointX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeWhitePointXWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl WhitePointX write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlWhitePointX : public SubscribeAttribute { -public: - SubscribeAttributeColorControlWhitePointX() - : SubscribeAttribute("white-point-x") - { - } - - ~SubscribeAttributeColorControlWhitePointX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWhitePointXWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.WhitePointX response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute WhitePointY - */ -class ReadColorControlWhitePointY : public ReadAttribute { -public: - ReadColorControlWhitePointY() - : ReadAttribute("white-point-y") - { - } - - ~ReadColorControlWhitePointY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWhitePointYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.WhitePointY response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl WhitePointY read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlWhitePointY : public WriteAttribute { -public: - WriteColorControlWhitePointY() - : WriteAttribute("white-point-y") - { - AddArgument("attr-name", "white-point-y"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlWhitePointY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeWhitePointYWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl WhitePointY write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlWhitePointY : public SubscribeAttribute { -public: - SubscribeAttributeColorControlWhitePointY() - : SubscribeAttribute("white-point-y") - { - } - - ~SubscribeAttributeColorControlWhitePointY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeWhitePointYWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.WhitePointY response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointRX - */ -class ReadColorControlColorPointRX : public ReadAttribute { -public: - ReadColorControlColorPointRX() - : ReadAttribute("color-point-rx") - { - } - - ~ReadColorControlColorPointRX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointRXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRX response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointRX read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointRX : public WriteAttribute { -public: - WriteColorControlColorPointRX() - : WriteAttribute("color-point-rx") - { - AddArgument("attr-name", "color-point-rx"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointRX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointRXWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointRX write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointRX : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointRX() - : SubscribeAttribute("color-point-rx") - { - } - - ~SubscribeAttributeColorControlColorPointRX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointRXWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRX response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointRY - */ -class ReadColorControlColorPointRY : public ReadAttribute { -public: - ReadColorControlColorPointRY() - : ReadAttribute("color-point-ry") - { - } - - ~ReadColorControlColorPointRY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000033) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointRYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRY response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointRY read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointRY : public WriteAttribute { -public: - WriteColorControlColorPointRY() - : WriteAttribute("color-point-ry") - { - AddArgument("attr-name", "color-point-ry"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointRY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointRYWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointRY write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointRY : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointRY() - : SubscribeAttribute("color-point-ry") - { - } - - ~SubscribeAttributeColorControlColorPointRY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointRYWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRY response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointRIntensity - */ -class ReadColorControlColorPointRIntensity : public ReadAttribute { -public: - ReadColorControlColorPointRIntensity() - : ReadAttribute("color-point-rintensity") - { - } - - ~ReadColorControlColorPointRIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000034) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointRIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRIntensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointRIntensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointRIntensity : public WriteAttribute { -public: - WriteColorControlColorPointRIntensity() - : WriteAttribute("color-point-rintensity") - { - AddArgument("attr-name", "color-point-rintensity"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointRIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeColorPointRIntensityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointRIntensity write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeColorControlColorPointRIntensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointRIntensity() - : SubscribeAttribute("color-point-rintensity") - { - } - - ~SubscribeAttributeColorControlColorPointRIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointRIntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointRIntensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointGX - */ -class ReadColorControlColorPointGX : public ReadAttribute { -public: - ReadColorControlColorPointGX() - : ReadAttribute("color-point-gx") - { - } - - ~ReadColorControlColorPointGX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000036) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointGXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGX response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointGX read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointGX : public WriteAttribute { -public: - WriteColorControlColorPointGX() - : WriteAttribute("color-point-gx") - { - AddArgument("attr-name", "color-point-gx"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointGX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000036) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointGXWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointGX write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointGX : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointGX() - : SubscribeAttribute("color-point-gx") - { - } - - ~SubscribeAttributeColorControlColorPointGX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000036) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointGXWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGX response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointGY - */ -class ReadColorControlColorPointGY : public ReadAttribute { -public: - ReadColorControlColorPointGY() - : ReadAttribute("color-point-gy") - { - } - - ~ReadColorControlColorPointGY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000037) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointGYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGY response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointGY read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointGY : public WriteAttribute { -public: - WriteColorControlColorPointGY() - : WriteAttribute("color-point-gy") - { - AddArgument("attr-name", "color-point-gy"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointGY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000037) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointGYWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointGY write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointGY : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointGY() - : SubscribeAttribute("color-point-gy") - { - } - - ~SubscribeAttributeColorControlColorPointGY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000037) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointGYWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGY response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointGIntensity - */ -class ReadColorControlColorPointGIntensity : public ReadAttribute { -public: - ReadColorControlColorPointGIntensity() - : ReadAttribute("color-point-gintensity") - { - } - - ~ReadColorControlColorPointGIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00000038) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointGIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGIntensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointGIntensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointGIntensity : public WriteAttribute { -public: - WriteColorControlColorPointGIntensity() - : WriteAttribute("color-point-gintensity") - { - AddArgument("attr-name", "color-point-gintensity"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointGIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00000038) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeColorPointGIntensityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointGIntensity write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeColorControlColorPointGIntensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointGIntensity() - : SubscribeAttribute("color-point-gintensity") - { - } - - ~SubscribeAttributeColorControlColorPointGIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00000038) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointGIntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointGIntensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointBX - */ -class ReadColorControlColorPointBX : public ReadAttribute { -public: - ReadColorControlColorPointBX() - : ReadAttribute("color-point-bx") - { - } - - ~ReadColorControlColorPointBX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000003A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointBXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBX response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointBX read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointBX : public WriteAttribute { -public: - WriteColorControlColorPointBX() - : WriteAttribute("color-point-bx") - { - AddArgument("attr-name", "color-point-bx"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointBX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x0000003A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointBXWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointBX write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointBX : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointBX() - : SubscribeAttribute("color-point-bx") - { - } - - ~SubscribeAttributeColorControlColorPointBX() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000003A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointBXWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBX response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointBY - */ -class ReadColorControlColorPointBY : public ReadAttribute { -public: - ReadColorControlColorPointBY() - : ReadAttribute("color-point-by") - { - } - - ~ReadColorControlColorPointBY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000003B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointBYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBY response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointBY read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointBY : public WriteAttribute { -public: - WriteColorControlColorPointBY() - : WriteAttribute("color-point-by") - { - AddArgument("attr-name", "color-point-by"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointBY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x0000003B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeColorPointBYWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointBY write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlColorPointBY : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointBY() - : SubscribeAttribute("color-point-by") - { - } - - ~SubscribeAttributeColorControlColorPointBY() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000003B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointBYWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBY response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorPointBIntensity - */ -class ReadColorControlColorPointBIntensity : public ReadAttribute { -public: - ReadColorControlColorPointBIntensity() - : ReadAttribute("color-point-bintensity") - { - } - - ~ReadColorControlColorPointBIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000003C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorPointBIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBIntensity response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorPointBIntensity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlColorPointBIntensity : public WriteAttribute { -public: - WriteColorControlColorPointBIntensity() - : WriteAttribute("color-point-bintensity") - { - AddArgument("attr-name", "color-point-bintensity"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlColorPointBIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x0000003C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeColorPointBIntensityWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ColorControl ColorPointBIntensity write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeColorControlColorPointBIntensity : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorPointBIntensity() - : SubscribeAttribute("color-point-bintensity") - { - } - - ~SubscribeAttributeColorControlColorPointBIntensity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000003C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorPointBIntensityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorPointBIntensity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnhancedCurrentHue - */ -class ReadColorControlEnhancedCurrentHue : public ReadAttribute { -public: - ReadColorControlEnhancedCurrentHue() - : ReadAttribute("enhanced-current-hue") - { - } - - ~ReadColorControlEnhancedCurrentHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.EnhancedCurrentHue response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl EnhancedCurrentHue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlEnhancedCurrentHue : public SubscribeAttribute { -public: - SubscribeAttributeColorControlEnhancedCurrentHue() - : SubscribeAttribute("enhanced-current-hue") - { - } - - ~SubscribeAttributeColorControlEnhancedCurrentHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnhancedCurrentHueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.EnhancedCurrentHue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute EnhancedColorMode - */ -class ReadColorControlEnhancedColorMode : public ReadAttribute { -public: - ReadColorControlEnhancedColorMode() - : ReadAttribute("enhanced-color-mode") - { - } - - ~ReadColorControlEnhancedColorMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEnhancedColorModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl EnhancedColorMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlEnhancedColorMode : public SubscribeAttribute { -public: - SubscribeAttributeColorControlEnhancedColorMode() - : SubscribeAttribute("enhanced-color-mode") - { - } - - ~SubscribeAttributeColorControlEnhancedColorMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeEnhancedColorModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorLoopActive - */ -class ReadColorControlColorLoopActive : public ReadAttribute { -public: - ReadColorControlColorLoopActive() - : ReadAttribute("color-loop-active") - { - } - - ~ReadColorControlColorLoopActive() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorLoopActive read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorLoopActive : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorLoopActive() - : SubscribeAttribute("color-loop-active") - { - } - - ~SubscribeAttributeColorControlColorLoopActive() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorLoopActiveWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorLoopDirection - */ -class ReadColorControlColorLoopDirection : public ReadAttribute { -public: - ReadColorControlColorLoopDirection() - : ReadAttribute("color-loop-direction") - { - } - - ~ReadColorControlColorLoopDirection() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopDirection response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorLoopDirection read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorLoopDirection : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorLoopDirection() - : SubscribeAttribute("color-loop-direction") - { - } - - ~SubscribeAttributeColorControlColorLoopDirection() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorLoopDirectionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopDirection response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorLoopTime - */ -class ReadColorControlColorLoopTime : public ReadAttribute { -public: - ReadColorControlColorLoopTime() - : ReadAttribute("color-loop-time") - { - } - - ~ReadColorControlColorLoopTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorLoopTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorLoopTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorLoopTime : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorLoopTime() - : SubscribeAttribute("color-loop-time") - { - } - - ~SubscribeAttributeColorControlColorLoopTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorLoopTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorLoopStartEnhancedHue - */ -class ReadColorControlColorLoopStartEnhancedHue : public ReadAttribute { -public: - ReadColorControlColorLoopStartEnhancedHue() - : ReadAttribute("color-loop-start-enhanced-hue") - { - } - - ~ReadColorControlColorLoopStartEnhancedHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorLoopStartEnhancedHue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorLoopStartEnhancedHue : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorLoopStartEnhancedHue() - : SubscribeAttribute("color-loop-start-enhanced-hue") - { - } - - ~SubscribeAttributeColorControlColorLoopStartEnhancedHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorLoopStartEnhancedHueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorLoopStoredEnhancedHue - */ -class ReadColorControlColorLoopStoredEnhancedHue : public ReadAttribute { -public: - ReadColorControlColorLoopStoredEnhancedHue() - : ReadAttribute("color-loop-stored-enhanced-hue") - { - } - - ~ReadColorControlColorLoopStoredEnhancedHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorLoopStoredEnhancedHue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorLoopStoredEnhancedHue : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorLoopStoredEnhancedHue() - : SubscribeAttribute("color-loop-stored-enhanced-hue") - { - } - - ~SubscribeAttributeColorControlColorLoopStoredEnhancedHue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorLoopStoredEnhancedHueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorCapabilities - */ -class ReadColorControlColorCapabilities : public ReadAttribute { -public: - ReadColorControlColorCapabilities() - : ReadAttribute("color-capabilities") - { - } - - ~ReadColorControlColorCapabilities() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000400A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorCapabilitiesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorCapabilities read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorCapabilities : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorCapabilities() - : SubscribeAttribute("color-capabilities") - { - } - - ~SubscribeAttributeColorControlColorCapabilities() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000400A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorCapabilitiesWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorTempPhysicalMinMireds - */ -class ReadColorControlColorTempPhysicalMinMireds : public ReadAttribute { -public: - ReadColorControlColorTempPhysicalMinMireds() - : ReadAttribute("color-temp-physical-min-mireds") - { - } - - ~ReadColorControlColorTempPhysicalMinMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000400B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorTempPhysicalMinMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorTempPhysicalMinMireds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorTempPhysicalMinMireds : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorTempPhysicalMinMireds() - : SubscribeAttribute("color-temp-physical-min-mireds") - { - } - - ~SubscribeAttributeColorControlColorTempPhysicalMinMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000400B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorTempPhysicalMinMiredsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ColorTempPhysicalMaxMireds - */ -class ReadColorControlColorTempPhysicalMaxMireds : public ReadAttribute { -public: - ReadColorControlColorTempPhysicalMaxMireds() - : ReadAttribute("color-temp-physical-max-mireds") - { - } - - ~ReadColorControlColorTempPhysicalMaxMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000400C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeColorTempPhysicalMaxMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ColorTempPhysicalMaxMireds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlColorTempPhysicalMaxMireds : public SubscribeAttribute { -public: - SubscribeAttributeColorControlColorTempPhysicalMaxMireds() - : SubscribeAttribute("color-temp-physical-max-mireds") - { - } - - ~SubscribeAttributeColorControlColorTempPhysicalMaxMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000400C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeColorTempPhysicalMaxMiredsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CoupleColorTempToLevelMinMireds - */ -class ReadColorControlCoupleColorTempToLevelMinMireds : public ReadAttribute { -public: - ReadColorControlCoupleColorTempToLevelMinMireds() - : ReadAttribute("couple-color-temp-to-level-min-mireds") - { - } - - ~ReadColorControlCoupleColorTempToLevelMinMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000400D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeCoupleColorTempToLevelMinMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl CoupleColorTempToLevelMinMireds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds : public SubscribeAttribute { -public: - SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() - : SubscribeAttribute("couple-color-temp-to-level-min-mireds") - { - } - - ~SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000400D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCoupleColorTempToLevelMinMiredsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute StartUpColorTemperatureMireds - */ -class ReadColorControlStartUpColorTemperatureMireds : public ReadAttribute { -public: - ReadColorControlStartUpColorTemperatureMireds() - : ReadAttribute("start-up-color-temperature-mireds") - { - } - - ~ReadColorControlStartUpColorTemperatureMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x00004010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStartUpColorTemperatureMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl StartUpColorTemperatureMireds read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteColorControlStartUpColorTemperatureMireds : public WriteAttribute { -public: - WriteColorControlStartUpColorTemperatureMireds() - : WriteAttribute("start-up-color-temperature-mireds") - { - AddArgument("attr-name", "start-up-color-temperature-mireds"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteColorControlStartUpColorTemperatureMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) WriteAttribute (0x00004010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeStartUpColorTemperatureMiredsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "ColorControl StartUpColorTemperatureMireds write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeColorControlStartUpColorTemperatureMireds : public SubscribeAttribute { -public: - SubscribeAttributeColorControlStartUpColorTemperatureMireds() - : SubscribeAttribute("start-up-color-temperature-mireds") - { - } - - ~SubscribeAttributeColorControlStartUpColorTemperatureMireds() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x00004010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStartUpColorTemperatureMiredsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadColorControlGeneratedCommandList : public ReadAttribute { -public: - ReadColorControlGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadColorControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeColorControlGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeColorControlGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadColorControlAcceptedCommandList : public ReadAttribute { -public: - ReadColorControlAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadColorControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeColorControlAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeColorControlAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadColorControlAttributeList : public ReadAttribute { -public: - ReadColorControlAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadColorControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeColorControlAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeColorControlAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadColorControlFeatureMap : public ReadAttribute { -public: - ReadColorControlFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadColorControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeColorControlFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeColorControlFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadColorControlClusterRevision : public ReadAttribute { -public: - ReadColorControlClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadColorControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ColorControl ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeColorControlClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeColorControlClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeColorControlClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000300) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ColorControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster BallastConfiguration | 0x0301 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * PhysicalMinLevel | 0x0000 | -| * PhysicalMaxLevel | 0x0001 | -| * BallastStatus | 0x0002 | -| * MinLevel | 0x0010 | -| * MaxLevel | 0x0011 | -| * IntrinsicBalanceFactor | 0x0014 | -| * BallastFactorAdjustment | 0x0015 | -| * LampQuantity | 0x0020 | -| * LampType | 0x0030 | -| * LampManufacturer | 0x0031 | -| * LampRatedHours | 0x0032 | -| * LampBurnHours | 0x0033 | -| * LampAlarmMode | 0x0034 | -| * LampBurnHoursTripPoint | 0x0035 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute PhysicalMinLevel - */ -class ReadBallastConfigurationPhysicalMinLevel : public ReadAttribute { -public: - ReadBallastConfigurationPhysicalMinLevel() - : ReadAttribute("physical-min-level") - { - } - - ~ReadBallastConfigurationPhysicalMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration PhysicalMinLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationPhysicalMinLevel : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationPhysicalMinLevel() - : SubscribeAttribute("physical-min-level") - { - } - - ~SubscribeAttributeBallastConfigurationPhysicalMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalMinLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalMaxLevel - */ -class ReadBallastConfigurationPhysicalMaxLevel : public ReadAttribute { -public: - ReadBallastConfigurationPhysicalMaxLevel() - : ReadAttribute("physical-max-level") - { - } - - ~ReadBallastConfigurationPhysicalMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration PhysicalMaxLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationPhysicalMaxLevel : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationPhysicalMaxLevel() - : SubscribeAttribute("physical-max-level") - { - } - - ~SubscribeAttributeBallastConfigurationPhysicalMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalMaxLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BallastStatus - */ -class ReadBallastConfigurationBallastStatus : public ReadAttribute { -public: - ReadBallastConfigurationBallastStatus() - : ReadAttribute("ballast-status") - { - } - - ~ReadBallastConfigurationBallastStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBallastStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.BallastStatus response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration BallastStatus read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationBallastStatus : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationBallastStatus() - : SubscribeAttribute("ballast-status") - { - } - - ~SubscribeAttributeBallastConfigurationBallastStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBallastStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.BallastStatus response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinLevel - */ -class ReadBallastConfigurationMinLevel : public ReadAttribute { -public: - ReadBallastConfigurationMinLevel() - : ReadAttribute("min-level") - { - } - - ~ReadBallastConfigurationMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.MinLevel response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration MinLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationMinLevel : public WriteAttribute { -public: - WriteBallastConfigurationMinLevel() - : WriteAttribute("min-level") - { - AddArgument("attr-name", "min-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeMinLevelWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration MinLevel write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeBallastConfigurationMinLevel : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationMinLevel() - : SubscribeAttribute("min-level") - { - } - - ~SubscribeAttributeBallastConfigurationMinLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.MinLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxLevel - */ -class ReadBallastConfigurationMaxLevel : public ReadAttribute { -public: - ReadBallastConfigurationMaxLevel() - : ReadAttribute("max-level") - { - } - - ~ReadBallastConfigurationMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.MaxLevel response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration MaxLevel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationMaxLevel : public WriteAttribute { -public: - WriteBallastConfigurationMaxLevel() - : WriteAttribute("max-level") - { - AddArgument("attr-name", "max-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeMaxLevelWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration MaxLevel write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeBallastConfigurationMaxLevel : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationMaxLevel() - : SubscribeAttribute("max-level") - { - } - - ~SubscribeAttributeBallastConfigurationMaxLevel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxLevelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.MaxLevel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute IntrinsicBalanceFactor - */ -class ReadBallastConfigurationIntrinsicBalanceFactor : public ReadAttribute { -public: - ReadBallastConfigurationIntrinsicBalanceFactor() - : ReadAttribute("intrinsic-balance-factor") - { - } - - ~ReadBallastConfigurationIntrinsicBalanceFactor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeIntrinsicBalanceFactorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.IntrinsicBalanceFactor response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration IntrinsicBalanceFactor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationIntrinsicBalanceFactor : public WriteAttribute { -public: - WriteBallastConfigurationIntrinsicBalanceFactor() - : WriteAttribute("intrinsic-balance-factor") - { - AddArgument("attr-name", "intrinsic-balance-factor"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationIntrinsicBalanceFactor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeIntrinsicBalanceFactorWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration IntrinsicBalanceFactor write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor() - : SubscribeAttribute("intrinsic-balance-factor") - { - } - - ~SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeIntrinsicBalanceFactorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.IntrinsicBalanceFactor response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute BallastFactorAdjustment - */ -class ReadBallastConfigurationBallastFactorAdjustment : public ReadAttribute { -public: - ReadBallastConfigurationBallastFactorAdjustment() - : ReadAttribute("ballast-factor-adjustment") - { - } - - ~ReadBallastConfigurationBallastFactorAdjustment() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBallastFactorAdjustmentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration BallastFactorAdjustment read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationBallastFactorAdjustment : public WriteAttribute { -public: - WriteBallastConfigurationBallastFactorAdjustment() - : WriteAttribute("ballast-factor-adjustment") - { - AddArgument("attr-name", "ballast-factor-adjustment"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationBallastFactorAdjustment() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeBallastFactorAdjustmentWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "BallastConfiguration BallastFactorAdjustment write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeBallastConfigurationBallastFactorAdjustment : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationBallastFactorAdjustment() - : SubscribeAttribute("ballast-factor-adjustment") - { - } - - ~SubscribeAttributeBallastConfigurationBallastFactorAdjustment() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBallastFactorAdjustmentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampQuantity - */ -class ReadBallastConfigurationLampQuantity : public ReadAttribute { -public: - ReadBallastConfigurationLampQuantity() - : ReadAttribute("lamp-quantity") - { - } - - ~ReadBallastConfigurationLampQuantity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampQuantityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampQuantity response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampQuantity read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationLampQuantity : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampQuantity() - : SubscribeAttribute("lamp-quantity") - { - } - - ~SubscribeAttributeBallastConfigurationLampQuantity() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampQuantityWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampQuantity response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampType - */ -class ReadBallastConfigurationLampType : public ReadAttribute { -public: - ReadBallastConfigurationLampType() - : ReadAttribute("lamp-type") - { - } - - ~ReadBallastConfigurationLampType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampTypeWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampType response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampType : public WriteAttribute { -public: - WriteBallastConfigurationLampType() - : WriteAttribute("lamp-type") - { - AddArgument("attr-name", "lamp-type"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeLampTypeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampType write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::ByteSpan mValue; -}; - -class SubscribeAttributeBallastConfigurationLampType : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampType() - : SubscribeAttribute("lamp-type") - { - } - - ~SubscribeAttributeBallastConfigurationLampType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampManufacturer - */ -class ReadBallastConfigurationLampManufacturer : public ReadAttribute { -public: - ReadBallastConfigurationLampManufacturer() - : ReadAttribute("lamp-manufacturer") - { - } - - ~ReadBallastConfigurationLampManufacturer() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampManufacturerWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampManufacturer response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampManufacturer read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampManufacturer : public WriteAttribute { -public: - WriteBallastConfigurationLampManufacturer() - : WriteAttribute("lamp-manufacturer") - { - AddArgument("attr-name", "lamp-manufacturer"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampManufacturer() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeLampManufacturerWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampManufacturer write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::ByteSpan mValue; -}; - -class SubscribeAttributeBallastConfigurationLampManufacturer : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampManufacturer() - : SubscribeAttribute("lamp-manufacturer") - { - } - - ~SubscribeAttributeBallastConfigurationLampManufacturer() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampManufacturerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampManufacturer response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampRatedHours - */ -class ReadBallastConfigurationLampRatedHours : public ReadAttribute { -public: - ReadBallastConfigurationLampRatedHours() - : ReadAttribute("lamp-rated-hours") - { - } - - ~ReadBallastConfigurationLampRatedHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampRatedHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampRatedHours response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampRatedHours read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampRatedHours : public WriteAttribute { -public: - WriteBallastConfigurationLampRatedHours() - : WriteAttribute("lamp-rated-hours") - { - AddArgument("attr-name", "lamp-rated-hours"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampRatedHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeLampRatedHoursWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampRatedHours write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeBallastConfigurationLampRatedHours : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampRatedHours() - : SubscribeAttribute("lamp-rated-hours") - { - } - - ~SubscribeAttributeBallastConfigurationLampRatedHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampRatedHoursWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampRatedHours response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampBurnHours - */ -class ReadBallastConfigurationLampBurnHours : public ReadAttribute { -public: - ReadBallastConfigurationLampBurnHours() - : ReadAttribute("lamp-burn-hours") - { - } - - ~ReadBallastConfigurationLampBurnHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000033) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampBurnHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampBurnHours response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampBurnHours read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampBurnHours : public WriteAttribute { -public: - WriteBallastConfigurationLampBurnHours() - : WriteAttribute("lamp-burn-hours") - { - AddArgument("attr-name", "lamp-burn-hours"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampBurnHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeLampBurnHoursWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampBurnHours write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeBallastConfigurationLampBurnHours : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampBurnHours() - : SubscribeAttribute("lamp-burn-hours") - { - } - - ~SubscribeAttributeBallastConfigurationLampBurnHours() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000033) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampBurnHoursWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampBurnHours response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampAlarmMode - */ -class ReadBallastConfigurationLampAlarmMode : public ReadAttribute { -public: - ReadBallastConfigurationLampAlarmMode() - : ReadAttribute("lamp-alarm-mode") - { - } - - ~ReadBallastConfigurationLampAlarmMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000034) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampAlarmModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampAlarmMode response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampAlarmMode read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampAlarmMode : public WriteAttribute { -public: - WriteBallastConfigurationLampAlarmMode() - : WriteAttribute("lamp-alarm-mode") - { - AddArgument("attr-name", "lamp-alarm-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampAlarmMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeLampAlarmModeWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampAlarmMode write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeBallastConfigurationLampAlarmMode : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampAlarmMode() - : SubscribeAttribute("lamp-alarm-mode") - { - } - - ~SubscribeAttributeBallastConfigurationLampAlarmMode() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000034) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampAlarmModeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampAlarmMode response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LampBurnHoursTripPoint - */ -class ReadBallastConfigurationLampBurnHoursTripPoint : public ReadAttribute { -public: - ReadBallastConfigurationLampBurnHoursTripPoint() - : ReadAttribute("lamp-burn-hours-trip-point") - { - } - - ~ReadBallastConfigurationLampBurnHoursTripPoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x00000035) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLampBurnHoursTripPointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration LampBurnHoursTripPoint read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteBallastConfigurationLampBurnHoursTripPoint : public WriteAttribute { -public: - WriteBallastConfigurationLampBurnHoursTripPoint() - : WriteAttribute("lamp-burn-hours-trip-point") - { - AddArgument("attr-name", "lamp-burn-hours-trip-point"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteBallastConfigurationLampBurnHoursTripPoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) WriteAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster - writeAttributeLampBurnHoursTripPointWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("BallastConfiguration LampBurnHoursTripPoint write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() - : SubscribeAttribute("lamp-burn-hours-trip-point") - { - } - - ~SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x00000035) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLampBurnHoursTripPointWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadBallastConfigurationGeneratedCommandList : public ReadAttribute { -public: - ReadBallastConfigurationGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadBallastConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeBallastConfigurationGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadBallastConfigurationAcceptedCommandList : public ReadAttribute { -public: - ReadBallastConfigurationAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadBallastConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeBallastConfigurationAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadBallastConfigurationAttributeList : public ReadAttribute { -public: - ReadBallastConfigurationAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadBallastConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeBallastConfigurationAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadBallastConfigurationFeatureMap : public ReadAttribute { -public: - ReadBallastConfigurationFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadBallastConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeBallastConfigurationFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadBallastConfigurationClusterRevision : public ReadAttribute { -public: - ReadBallastConfigurationClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadBallastConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("BallastConfiguration ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeBallastConfigurationClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeBallastConfigurationClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeBallastConfigurationClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000301) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"BallastConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster IlluminanceMeasurement | 0x0400 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasuredValue | 0x0000 | -| * MinMeasuredValue | 0x0001 | -| * MaxMeasuredValue | 0x0002 | -| * Tolerance | 0x0003 | -| * LightSensorType | 0x0004 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MeasuredValue - */ -class ReadIlluminanceMeasurementMeasuredValue : public ReadAttribute { -public: - ReadIlluminanceMeasurementMeasuredValue() - : ReadAttribute("measured-value") - { - } - - ~ReadIlluminanceMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement MeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementMeasuredValue() - : SubscribeAttribute("measured-value") - { - } - - ~SubscribeAttributeIlluminanceMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinMeasuredValue - */ -class ReadIlluminanceMeasurementMinMeasuredValue : public ReadAttribute { -public: - ReadIlluminanceMeasurementMinMeasuredValue() - : ReadAttribute("min-measured-value") - { - } - - ~ReadIlluminanceMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement MinMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementMinMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() - : SubscribeAttribute("min-measured-value") - { - } - - ~SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxMeasuredValue - */ -class ReadIlluminanceMeasurementMaxMeasuredValue : public ReadAttribute { -public: - ReadIlluminanceMeasurementMaxMeasuredValue() - : ReadAttribute("max-measured-value") - { - } - - ~ReadIlluminanceMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement MaxMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() - : SubscribeAttribute("max-measured-value") - { - } - - ~SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Tolerance - */ -class ReadIlluminanceMeasurementTolerance : public ReadAttribute { -public: - ReadIlluminanceMeasurementTolerance() - : ReadAttribute("tolerance") - { - } - - ~ReadIlluminanceMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.Tolerance response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement Tolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementTolerance : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementTolerance() - : SubscribeAttribute("tolerance") - { - } - - ~SubscribeAttributeIlluminanceMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute LightSensorType - */ -class ReadIlluminanceMeasurementLightSensorType : public ReadAttribute { -public: - ReadIlluminanceMeasurementLightSensorType() - : ReadAttribute("light-sensor-type") - { - } - - ~ReadIlluminanceMeasurementLightSensorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.LightSensorType response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement LightSensorType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementLightSensorType : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementLightSensorType() - : SubscribeAttribute("light-sensor-type") - { - } - - ~SubscribeAttributeIlluminanceMeasurementLightSensorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLightSensorTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.LightSensorType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadIlluminanceMeasurementGeneratedCommandList : public ReadAttribute { -public: - ReadIlluminanceMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadIlluminanceMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadIlluminanceMeasurementAcceptedCommandList : public ReadAttribute { -public: - ReadIlluminanceMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadIlluminanceMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadIlluminanceMeasurementAttributeList : public ReadAttribute { -public: - ReadIlluminanceMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadIlluminanceMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeIlluminanceMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadIlluminanceMeasurementFeatureMap : public ReadAttribute { -public: - ReadIlluminanceMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadIlluminanceMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeIlluminanceMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadIlluminanceMeasurementClusterRevision : public ReadAttribute { -public: - ReadIlluminanceMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadIlluminanceMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("IlluminanceMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeIlluminanceMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeIlluminanceMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeIlluminanceMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000400) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster TemperatureMeasurement | 0x0402 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasuredValue | 0x0000 | -| * MinMeasuredValue | 0x0001 | -| * MaxMeasuredValue | 0x0002 | -| * Tolerance | 0x0003 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MeasuredValue - */ -class ReadTemperatureMeasurementMeasuredValue : public ReadAttribute { -public: - ReadTemperatureMeasurementMeasuredValue() - : ReadAttribute("measured-value") - { - } - - ~ReadTemperatureMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement MeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementMeasuredValue() - : SubscribeAttribute("measured-value") - { - } - - ~SubscribeAttributeTemperatureMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinMeasuredValue - */ -class ReadTemperatureMeasurementMinMeasuredValue : public ReadAttribute { -public: - ReadTemperatureMeasurementMinMeasuredValue() - : ReadAttribute("min-measured-value") - { - } - - ~ReadTemperatureMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement MinMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementMinMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementMinMeasuredValue() - : SubscribeAttribute("min-measured-value") - { - } - - ~SubscribeAttributeTemperatureMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxMeasuredValue - */ -class ReadTemperatureMeasurementMaxMeasuredValue : public ReadAttribute { -public: - ReadTemperatureMeasurementMaxMeasuredValue() - : ReadAttribute("max-measured-value") - { - } - - ~ReadTemperatureMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement MaxMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementMaxMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() - : SubscribeAttribute("max-measured-value") - { - } - - ~SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Tolerance - */ -class ReadTemperatureMeasurementTolerance : public ReadAttribute { -public: - ReadTemperatureMeasurementTolerance() - : ReadAttribute("tolerance") - { - } - - ~ReadTemperatureMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.Tolerance response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement Tolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementTolerance : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementTolerance() - : SubscribeAttribute("tolerance") - { - } - - ~SubscribeAttributeTemperatureMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadTemperatureMeasurementGeneratedCommandList : public ReadAttribute { -public: - ReadTemperatureMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadTemperatureMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeTemperatureMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadTemperatureMeasurementAcceptedCommandList : public ReadAttribute { -public: - ReadTemperatureMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadTemperatureMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeTemperatureMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadTemperatureMeasurementAttributeList : public ReadAttribute { -public: - ReadTemperatureMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadTemperatureMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeTemperatureMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadTemperatureMeasurementFeatureMap : public ReadAttribute { -public: - ReadTemperatureMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadTemperatureMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeTemperatureMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadTemperatureMeasurementClusterRevision : public ReadAttribute { -public: - ReadTemperatureMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadTemperatureMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("TemperatureMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTemperatureMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeTemperatureMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeTemperatureMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000402) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TemperatureMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster PressureMeasurement | 0x0403 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasuredValue | 0x0000 | -| * MinMeasuredValue | 0x0001 | -| * MaxMeasuredValue | 0x0002 | -| * Tolerance | 0x0003 | -| * ScaledValue | 0x0010 | -| * MinScaledValue | 0x0011 | -| * MaxScaledValue | 0x0012 | -| * ScaledTolerance | 0x0013 | -| * Scale | 0x0014 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MeasuredValue - */ -class ReadPressureMeasurementMeasuredValue : public ReadAttribute { -public: - ReadPressureMeasurementMeasuredValue() - : ReadAttribute("measured-value") - { - } - - ~ReadPressureMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement MeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementMeasuredValue() - : SubscribeAttribute("measured-value") - { - } - - ~SubscribeAttributePressureMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinMeasuredValue - */ -class ReadPressureMeasurementMinMeasuredValue : public ReadAttribute { -public: - ReadPressureMeasurementMinMeasuredValue() - : ReadAttribute("min-measured-value") - { - } - - ~ReadPressureMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MinMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement MinMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementMinMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementMinMeasuredValue() - : SubscribeAttribute("min-measured-value") - { - } - - ~SubscribeAttributePressureMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxMeasuredValue - */ -class ReadPressureMeasurementMaxMeasuredValue : public ReadAttribute { -public: - ReadPressureMeasurementMaxMeasuredValue() - : ReadAttribute("max-measured-value") - { - } - - ~ReadPressureMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement MaxMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementMaxMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementMaxMeasuredValue() - : SubscribeAttribute("max-measured-value") - { - } - - ~SubscribeAttributePressureMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Tolerance - */ -class ReadPressureMeasurementTolerance : public ReadAttribute { -public: - ReadPressureMeasurementTolerance() - : ReadAttribute("tolerance") - { - } - - ~ReadPressureMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement Tolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementTolerance : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementTolerance() - : SubscribeAttribute("tolerance") - { - } - - ~SubscribeAttributePressureMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ScaledValue - */ -class ReadPressureMeasurementScaledValue : public ReadAttribute { -public: - ReadPressureMeasurementScaledValue() - : ReadAttribute("scaled-value") - { - } - - ~ReadPressureMeasurementScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement ScaledValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementScaledValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementScaledValue() - : SubscribeAttribute("scaled-value") - { - } - - ~SubscribeAttributePressureMeasurementScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeScaledValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinScaledValue - */ -class ReadPressureMeasurementMinScaledValue : public ReadAttribute { -public: - ReadPressureMeasurementMinScaledValue() - : ReadAttribute("min-scaled-value") - { - } - - ~ReadPressureMeasurementMinScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement MinScaledValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementMinScaledValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementMinScaledValue() - : SubscribeAttribute("min-scaled-value") - { - } - - ~SubscribeAttributePressureMeasurementMinScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinScaledValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxScaledValue - */ -class ReadPressureMeasurementMaxScaledValue : public ReadAttribute { -public: - ReadPressureMeasurementMaxScaledValue() - : ReadAttribute("max-scaled-value") - { - } - - ~ReadPressureMeasurementMaxScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement MaxScaledValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementMaxScaledValue : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementMaxScaledValue() - : SubscribeAttribute("max-scaled-value") - { - } - - ~SubscribeAttributePressureMeasurementMaxScaledValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxScaledValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ScaledTolerance - */ -class ReadPressureMeasurementScaledTolerance : public ReadAttribute { -public: - ReadPressureMeasurementScaledTolerance() - : ReadAttribute("scaled-tolerance") - { - } - - ~ReadPressureMeasurementScaledTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeScaledToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement ScaledTolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementScaledTolerance : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementScaledTolerance() - : SubscribeAttribute("scaled-tolerance") - { - } - - ~SubscribeAttributePressureMeasurementScaledTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeScaledToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Scale - */ -class ReadPressureMeasurementScale : public ReadAttribute { -public: - ReadPressureMeasurementScale() - : ReadAttribute("scale") - { - } - - ~ReadPressureMeasurementScale() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeScaleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.Scale response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement Scale read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementScale : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementScale() - : SubscribeAttribute("scale") - { - } - - ~SubscribeAttributePressureMeasurementScale() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeScaleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.Scale response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadPressureMeasurementGeneratedCommandList : public ReadAttribute { -public: - ReadPressureMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadPressureMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributePressureMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadPressureMeasurementAcceptedCommandList : public ReadAttribute { -public: - ReadPressureMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadPressureMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributePressureMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadPressureMeasurementAttributeList : public ReadAttribute { -public: - ReadPressureMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadPressureMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributePressureMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadPressureMeasurementFeatureMap : public ReadAttribute { -public: - ReadPressureMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadPressureMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributePressureMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadPressureMeasurementClusterRevision : public ReadAttribute { -public: - ReadPressureMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadPressureMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("PressureMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributePressureMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributePressureMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributePressureMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"PressureMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster FlowMeasurement | 0x0404 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasuredValue | 0x0000 | -| * MinMeasuredValue | 0x0001 | -| * MaxMeasuredValue | 0x0002 | -| * Tolerance | 0x0003 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MeasuredValue - */ -class ReadFlowMeasurementMeasuredValue : public ReadAttribute { -public: - ReadFlowMeasurementMeasuredValue() - : ReadAttribute("measured-value") - { - } - - ~ReadFlowMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement MeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementMeasuredValue() - : SubscribeAttribute("measured-value") - { - } - - ~SubscribeAttributeFlowMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinMeasuredValue - */ -class ReadFlowMeasurementMinMeasuredValue : public ReadAttribute { -public: - ReadFlowMeasurementMinMeasuredValue() - : ReadAttribute("min-measured-value") - { - } - - ~ReadFlowMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MinMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement MinMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementMinMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementMinMeasuredValue() - : SubscribeAttribute("min-measured-value") - { - } - - ~SubscribeAttributeFlowMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxMeasuredValue - */ -class ReadFlowMeasurementMaxMeasuredValue : public ReadAttribute { -public: - ReadFlowMeasurementMaxMeasuredValue() - : ReadAttribute("max-measured-value") - { - } - - ~ReadFlowMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement MaxMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementMaxMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementMaxMeasuredValue() - : SubscribeAttribute("max-measured-value") - { - } - - ~SubscribeAttributeFlowMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Tolerance - */ -class ReadFlowMeasurementTolerance : public ReadAttribute { -public: - ReadFlowMeasurementTolerance() - : ReadAttribute("tolerance") - { - } - - ~ReadFlowMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement Tolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementTolerance : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementTolerance() - : SubscribeAttribute("tolerance") - { - } - - ~SubscribeAttributeFlowMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadFlowMeasurementGeneratedCommandList : public ReadAttribute { -public: - ReadFlowMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadFlowMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeFlowMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadFlowMeasurementAcceptedCommandList : public ReadAttribute { -public: - ReadFlowMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadFlowMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeFlowMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadFlowMeasurementAttributeList : public ReadAttribute { -public: - ReadFlowMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadFlowMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeFlowMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadFlowMeasurementFeatureMap : public ReadAttribute { -public: - ReadFlowMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadFlowMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeFlowMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadFlowMeasurementClusterRevision : public ReadAttribute { -public: - ReadFlowMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadFlowMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("FlowMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeFlowMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeFlowMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeFlowMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000404) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"FlowMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster RelativeHumidityMeasurement | 0x0405 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasuredValue | 0x0000 | -| * MinMeasuredValue | 0x0001 | -| * MaxMeasuredValue | 0x0002 | -| * Tolerance | 0x0003 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MeasuredValue - */ -class ReadRelativeHumidityMeasurementMeasuredValue : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementMeasuredValue() - : ReadAttribute("measured-value") - { - } - - ~ReadRelativeHumidityMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement MeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() - : SubscribeAttribute("measured-value") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MinMeasuredValue - */ -class ReadRelativeHumidityMeasurementMinMeasuredValue : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementMinMeasuredValue() - : ReadAttribute("min-measured-value") - { - } - - ~ReadRelativeHumidityMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement MinMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() - : SubscribeAttribute("min-measured-value") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMinMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute MaxMeasuredValue - */ -class ReadRelativeHumidityMeasurementMaxMeasuredValue : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementMaxMeasuredValue() - : ReadAttribute("max-measured-value") - { - } - - ~ReadRelativeHumidityMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement MaxMeasuredValue read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() - : SubscribeAttribute("max-measured-value") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMaxMeasuredValueWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Tolerance - */ -class ReadRelativeHumidityMeasurementTolerance : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementTolerance() - : ReadAttribute("tolerance") - { - } - - ~ReadRelativeHumidityMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement Tolerance read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementTolerance : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementTolerance() - : SubscribeAttribute("tolerance") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementTolerance() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeToleranceWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadRelativeHumidityMeasurementGeneratedCommandList : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadRelativeHumidityMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadRelativeHumidityMeasurementAcceptedCommandList : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadRelativeHumidityMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadRelativeHumidityMeasurementAttributeList : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadRelativeHumidityMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadRelativeHumidityMeasurementFeatureMap : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadRelativeHumidityMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadRelativeHumidityMeasurementClusterRevision : public ReadAttribute { -public: - ReadRelativeHumidityMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadRelativeHumidityMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("RelativeHumidityMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeRelativeHumidityMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeRelativeHumidityMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeRelativeHumidityMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000405) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster OccupancySensing | 0x0406 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * Occupancy | 0x0000 | -| * OccupancySensorType | 0x0001 | -| * OccupancySensorTypeBitmap | 0x0002 | -| * PirOccupiedToUnoccupiedDelay | 0x0010 | -| * PirUnoccupiedToOccupiedDelay | 0x0011 | -| * PirUnoccupiedToOccupiedThreshold | 0x0012 | -| * UltrasonicOccupiedToUnoccupiedDelay | 0x0020 | -| * UltrasonicUnoccupiedToOccupiedDelay | 0x0021 | -| * UltrasonicUnoccupiedToOccupiedThreshold | 0x0022 | -| * PhysicalContactOccupiedToUnoccupiedDelay | 0x0030 | -| * PhysicalContactUnoccupiedToOccupiedDelay | 0x0031 | -| * PhysicalContactUnoccupiedToOccupiedThreshold | 0x0032 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute Occupancy - */ -class ReadOccupancySensingOccupancy : public ReadAttribute { -public: - ReadOccupancySensingOccupancy() - : ReadAttribute("occupancy") - { - } - - ~ReadOccupancySensingOccupancy() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupancyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.Occupancy response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing Occupancy read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingOccupancy : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingOccupancy() - : SubscribeAttribute("occupancy") - { - } - - ~SubscribeAttributeOccupancySensingOccupancy() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupancyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.Occupancy response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupancySensorType - */ -class ReadOccupancySensingOccupancySensorType : public ReadAttribute { -public: - ReadOccupancySensingOccupancySensorType() - : ReadAttribute("occupancy-sensor-type") - { - } - - ~ReadOccupancySensingOccupancySensorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupancySensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.OccupancySensorType response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing OccupancySensorType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingOccupancySensorType : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingOccupancySensorType() - : SubscribeAttribute("occupancy-sensor-type") - { - } - - ~SubscribeAttributeOccupancySensingOccupancySensorType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupancySensorTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.OccupancySensorType response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute OccupancySensorTypeBitmap - */ -class ReadOccupancySensingOccupancySensorTypeBitmap : public ReadAttribute { -public: - ReadOccupancySensingOccupancySensorTypeBitmap() - : ReadAttribute("occupancy-sensor-type-bitmap") - { - } - - ~ReadOccupancySensingOccupancySensorTypeBitmap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOccupancySensorTypeBitmapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing OccupancySensorTypeBitmap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() - : SubscribeAttribute("occupancy-sensor-type-bitmap") - { - } - - ~SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOccupancySensorTypeBitmapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PirOccupiedToUnoccupiedDelay - */ -class ReadOccupancySensingPirOccupiedToUnoccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingPirOccupiedToUnoccupiedDelay() - : ReadAttribute("pir-occupied-to-unoccupied-delay") - { - } - - ~ReadOccupancySensingPirOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePIROccupiedToUnoccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PIROccupiedToUnoccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPirOccupiedToUnoccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingPirOccupiedToUnoccupiedDelay() - : WriteAttribute("pir-occupied-to-unoccupied-delay") - { - AddArgument("attr-name", "pir-occupied-to-unoccupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPirOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributePIROccupiedToUnoccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing PIROccupiedToUnoccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay() - : SubscribeAttribute("pir-occupied-to-unoccupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePIROccupiedToUnoccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PirUnoccupiedToOccupiedDelay - */ -class ReadOccupancySensingPirUnoccupiedToOccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingPirUnoccupiedToOccupiedDelay() - : ReadAttribute("pir-unoccupied-to-occupied-delay") - { - } - - ~ReadOccupancySensingPirUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePIRUnoccupiedToOccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PIRUnoccupiedToOccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPirUnoccupiedToOccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingPirUnoccupiedToOccupiedDelay() - : WriteAttribute("pir-unoccupied-to-occupied-delay") - { - AddArgument("attr-name", "pir-unoccupied-to-occupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPirUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributePIRUnoccupiedToOccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing PIRUnoccupiedToOccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay() - : SubscribeAttribute("pir-unoccupied-to-occupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePIRUnoccupiedToOccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PirUnoccupiedToOccupiedThreshold - */ -class ReadOccupancySensingPirUnoccupiedToOccupiedThreshold : public ReadAttribute { -public: - ReadOccupancySensingPirUnoccupiedToOccupiedThreshold() - : ReadAttribute("pir-unoccupied-to-occupied-threshold") - { - } - - ~ReadOccupancySensingPirUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributePIRUnoccupiedToOccupiedThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PIRUnoccupiedToOccupiedThreshold read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPirUnoccupiedToOccupiedThreshold : public WriteAttribute { -public: - WriteOccupancySensingPirUnoccupiedToOccupiedThreshold() - : WriteAttribute("pir-unoccupied-to-occupied-threshold") - { - AddArgument("attr-name", "pir-unoccupied-to-occupied-threshold"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPirUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributePIRUnoccupiedToOccupiedThresholdWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing " - "PIRUnoccupiedToOccupiedThreshold write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold() - : SubscribeAttribute("pir-unoccupied-to-occupied-threshold") - { - } - - ~SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePIRUnoccupiedToOccupiedThresholdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UltrasonicOccupiedToUnoccupiedDelay - */ -class ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() - : ReadAttribute("ultrasonic-occupied-to-unoccupied-delay") - { - } - - ~ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUltrasonicOccupiedToUnoccupiedDelayWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing UltrasonicOccupiedToUnoccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() - : WriteAttribute("ultrasonic-occupied-to-unoccupied-delay") - { - AddArgument("attr-name", "ultrasonic-occupied-to-unoccupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing " - "UltrasonicOccupiedToUnoccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() - : SubscribeAttribute("ultrasonic-occupied-to-unoccupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUltrasonicOccupiedToUnoccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UltrasonicUnoccupiedToOccupiedDelay - */ -class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() - : ReadAttribute("ultrasonic-unoccupied-to-occupied-delay") - { - } - - ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUltrasonicUnoccupiedToOccupiedDelayWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() - : WriteAttribute("ultrasonic-unoccupied-to-occupied-delay") - { - AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing " - "UltrasonicUnoccupiedToOccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() - : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUltrasonicUnoccupiedToOccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute UltrasonicUnoccupiedToOccupiedThreshold - */ -class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public ReadAttribute { -public: - ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() - : ReadAttribute("ultrasonic-unoccupied-to-occupied-threshold") - { - } - - ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000022) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUltrasonicUnoccupiedToOccupiedThresholdWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedThreshold read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public WriteAttribute { -public: - WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() - : WriteAttribute("ultrasonic-unoccupied-to-occupied-threshold") - { - AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-threshold"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster - writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "OccupancySensing " - "UltrasonicUnoccupiedToOccupiedThreshold write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() - : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-threshold") - { - } - - ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalContactOccupiedToUnoccupiedDelay - */ -class ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() - : ReadAttribute("physical-contact-occupied-to-unoccupied-delay") - { - } - - ~ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalContactOccupiedToUnoccupiedDelayWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PhysicalContactOccupiedToUnoccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() - : WriteAttribute("physical-contact-occupied-to-unoccupied-delay") - { - AddArgument("attr-name", "physical-contact-occupied-to-unoccupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "OccupancySensing " - "PhysicalContactOccupiedToUnoccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() - : SubscribeAttribute("physical-contact-occupied-to-unoccupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalContactOccupiedToUnoccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalContactUnoccupiedToOccupiedDelay - */ -class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public ReadAttribute { -public: - ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() - : ReadAttribute("physical-contact-unoccupied-to-occupied-delay") - { - } - - ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalContactUnoccupiedToOccupiedDelayWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedDelay read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public WriteAttribute { -public: - WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() - : WriteAttribute("physical-contact-unoccupied-to-occupied-delay") - { - AddArgument("attr-name", "physical-contact-unoccupied-to-occupied-delay"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "OccupancySensing " - "PhysicalContactUnoccupiedToOccupiedDelay write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() - : SubscribeAttribute("physical-contact-unoccupied-to-occupied-delay") - { - } - - ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalContactUnoccupiedToOccupiedDelayWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PhysicalContactUnoccupiedToOccupiedThreshold - */ -class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public ReadAttribute { -public: - ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() - : ReadAttribute("physical-contact-unoccupied-to-occupied-threshold") - { - } - - ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePhysicalContactUnoccupiedToOccupiedThresholdWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedThreshold response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedThreshold read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public WriteAttribute { -public: - WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() - : WriteAttribute("physical-contact-unoccupied-to-occupied-threshold") - { - AddArgument("attr-name", "physical-contact-unoccupied-to-occupied-threshold"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) WriteAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("OccupancySensing " - "PhysicalContactUnoccupiedToOccupiedTh" - "reshold write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() - : SubscribeAttribute("physical-contact-unoccupied-to-occupied-threshold") - { - } - - ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedThreshold response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadOccupancySensingGeneratedCommandList : public ReadAttribute { -public: - ReadOccupancySensingGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadOccupancySensingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeOccupancySensingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadOccupancySensingAcceptedCommandList : public ReadAttribute { -public: - ReadOccupancySensingAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadOccupancySensingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeOccupancySensingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadOccupancySensingAttributeList : public ReadAttribute { -public: - ReadOccupancySensingAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadOccupancySensingAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeOccupancySensingAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadOccupancySensingFeatureMap : public ReadAttribute { -public: - ReadOccupancySensingFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadOccupancySensingFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeOccupancySensingFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadOccupancySensingClusterRevision : public ReadAttribute { -public: - ReadOccupancySensingClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadOccupancySensingClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("OccupancySensing ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeOccupancySensingClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeOccupancySensingClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeOccupancySensingClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000406) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"OccupancySensing.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster WakeOnLan | 0x0503 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MACAddress | 0x0000 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute MACAddress - */ -class ReadWakeOnLanMACAddress : public ReadAttribute { -public: - ReadWakeOnLanMACAddress() - : ReadAttribute("macaddress") - { - } - - ~ReadWakeOnLanMACAddress() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMACAddressWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN MACAddress read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanMACAddress : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanMACAddress() - : SubscribeAttribute("macaddress") - { - } - - ~SubscribeAttributeWakeOnLanMACAddress() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMACAddressWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadWakeOnLanGeneratedCommandList : public ReadAttribute { -public: - ReadWakeOnLanGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadWakeOnLanGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeWakeOnLanGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadWakeOnLanAcceptedCommandList : public ReadAttribute { -public: - ReadWakeOnLanAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadWakeOnLanAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeWakeOnLanAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadWakeOnLanAttributeList : public ReadAttribute { -public: - ReadWakeOnLanAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadWakeOnLanAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeWakeOnLanAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadWakeOnLanFeatureMap : public ReadAttribute { -public: - ReadWakeOnLanFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadWakeOnLanFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeWakeOnLanFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadWakeOnLanClusterRevision : public ReadAttribute { -public: - ReadWakeOnLanClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadWakeOnLanClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("WakeOnLAN ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeWakeOnLanClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeWakeOnLanClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeWakeOnLanClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000503) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster Channel | 0x0504 | -|------------------------------------------------------------------------------| -| Commands: | | -| * ChangeChannel | 0x00 | -| * ChangeChannelByNumber | 0x02 | -| * SkipChannel | 0x03 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * ChannelList | 0x0000 | -| * Lineup | 0x0001 | -| * CurrentChannel | 0x0002 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command ChangeChannel - */ -class ChannelChangeChannel : public ClusterCommand { -public: - ChannelChangeChannel() - : ClusterCommand("change-channel") - { - AddArgument("Match", &mRequest.match); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRChannelClusterChangeChannelParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.match = [[NSString alloc] initWithBytes:mRequest.match.data() - length:mRequest.match.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster changeChannelWithParams:params - completion:^( - MTRChannelClusterChangeChannelResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Channel::Commands::ChangeChannel::Type mRequest; -}; - -/* - * Command ChangeChannelByNumber - */ -class ChannelChangeChannelByNumber : public ClusterCommand { -public: - ChannelChangeChannelByNumber() - : ClusterCommand("change-channel-by-number") - { - AddArgument("MajorNumber", 0, UINT16_MAX, &mRequest.majorNumber); - AddArgument("MinorNumber", 0, UINT16_MAX, &mRequest.minorNumber); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRChannelClusterChangeChannelByNumberParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.majorNumber = [NSNumber numberWithUnsignedShort:mRequest.majorNumber]; - params.minorNumber = [NSNumber numberWithUnsignedShort:mRequest.minorNumber]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster changeChannelByNumberWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type mRequest; -}; - -/* - * Command SkipChannel - */ -class ChannelSkipChannel : public ClusterCommand { -public: - ChannelSkipChannel() - : ClusterCommand("skip-channel") - { - AddArgument("Count", 0, UINT16_MAX, &mRequest.count); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRChannelClusterSkipChannelParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.count = [NSNumber numberWithUnsignedShort:mRequest.count]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster skipChannelWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Channel::Commands::SkipChannel::Type mRequest; -}; - -/* - * Attribute ChannelList - */ -class ReadChannelChannelList : public ReadAttribute { -public: - ReadChannelChannelList() - : ReadAttribute("channel-list") - { - } - - ~ReadChannelChannelList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeChannelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.ChannelList response %@", [value description]); - if (error != nil) { - LogNSError("Channel ChannelList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelChannelList : public SubscribeAttribute { -public: - SubscribeAttributeChannelChannelList() - : SubscribeAttribute("channel-list") - { - } - - ~SubscribeAttributeChannelChannelList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeChannelListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.ChannelList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Lineup - */ -class ReadChannelLineup : public ReadAttribute { -public: - ReadChannelLineup() - : ReadAttribute("lineup") - { - } - - ~ReadChannelLineup() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeLineupWithCompletion:^(MTRChannelClusterLineupInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.Lineup response %@", [value description]); - if (error != nil) { - LogNSError("Channel Lineup read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelLineup : public SubscribeAttribute { -public: - SubscribeAttributeChannelLineup() - : SubscribeAttribute("lineup") - { - } - - ~SubscribeAttributeChannelLineup() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLineupWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRChannelClusterLineupInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.Lineup response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentChannel - */ -class ReadChannelCurrentChannel : public ReadAttribute { -public: - ReadChannelCurrentChannel() - : ReadAttribute("current-channel") - { - } - - ~ReadChannelCurrentChannel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster - readAttributeCurrentChannelWithCompletion:^(MTRChannelClusterChannelInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.CurrentChannel response %@", [value description]); - if (error != nil) { - LogNSError("Channel CurrentChannel read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelCurrentChannel : public SubscribeAttribute { -public: - SubscribeAttributeChannelCurrentChannel() - : SubscribeAttribute("current-channel") - { - } - - ~SubscribeAttributeChannelCurrentChannel() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentChannelWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRChannelClusterChannelInfo * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.CurrentChannel response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadChannelGeneratedCommandList : public ReadAttribute { -public: - ReadChannelGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadChannelGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Channel GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeChannelGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeChannelGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadChannelAcceptedCommandList : public ReadAttribute { -public: - ReadChannelAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadChannelAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("Channel AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeChannelAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeChannelAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadChannelAttributeList : public ReadAttribute { -public: - ReadChannelAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadChannelAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("Channel AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeChannelAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeChannelAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadChannelFeatureMap : public ReadAttribute { -public: - ReadChannelFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadChannelFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("Channel FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeChannelFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeChannelFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadChannelClusterRevision : public ReadAttribute { -public: - ReadChannelClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadChannelClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("Channel ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeChannelClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeChannelClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeChannelClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Channel.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster TargetNavigator | 0x0505 | -|------------------------------------------------------------------------------| -| Commands: | | -| * NavigateTarget | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * TargetList | 0x0000 | -| * CurrentTarget | 0x0001 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command NavigateTarget - */ -class TargetNavigatorNavigateTarget : public ClusterCommand { -public: - TargetNavigatorNavigateTarget() - : ClusterCommand("navigate-target") - { - AddArgument("Target", 0, UINT8_MAX, &mRequest.target); - AddArgument("Data", &mRequest.data); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRTargetNavigatorClusterNavigateTargetParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.target = [NSNumber numberWithUnsignedChar:mRequest.target]; - if (mRequest.data.HasValue()) { - params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() - length:mRequest.data.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.data = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster navigateTargetWithParams:params - completion:^(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type mRequest; -}; - -/* - * Attribute TargetList - */ -class ReadTargetNavigatorTargetList : public ReadAttribute { -public: - ReadTargetNavigatorTargetList() - : ReadAttribute("target-list") - { - } - - ~ReadTargetNavigatorTargetList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTargetListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.TargetList response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator TargetList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorTargetList : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorTargetList() - : SubscribeAttribute("target-list") - { - } - - ~SubscribeAttributeTargetNavigatorTargetList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTargetListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.TargetList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentTarget - */ -class ReadTargetNavigatorCurrentTarget : public ReadAttribute { -public: - ReadTargetNavigatorCurrentTarget() - : ReadAttribute("current-target") - { - } - - ~ReadTargetNavigatorCurrentTarget() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentTargetWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator CurrentTarget read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorCurrentTarget : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorCurrentTarget() - : SubscribeAttribute("current-target") - { - } - - ~SubscribeAttributeTargetNavigatorCurrentTarget() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentTargetWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadTargetNavigatorGeneratedCommandList : public ReadAttribute { -public: - ReadTargetNavigatorGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadTargetNavigatorGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeTargetNavigatorGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadTargetNavigatorAcceptedCommandList : public ReadAttribute { -public: - ReadTargetNavigatorAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadTargetNavigatorAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeTargetNavigatorAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadTargetNavigatorAttributeList : public ReadAttribute { -public: - ReadTargetNavigatorAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadTargetNavigatorAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeTargetNavigatorAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadTargetNavigatorFeatureMap : public ReadAttribute { -public: - ReadTargetNavigatorFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadTargetNavigatorFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeTargetNavigatorFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadTargetNavigatorClusterRevision : public ReadAttribute { -public: - ReadTargetNavigatorClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadTargetNavigatorClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("TargetNavigator ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeTargetNavigatorClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeTargetNavigatorClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeTargetNavigatorClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000505) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"TargetNavigator.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster MediaPlayback | 0x0506 | -|------------------------------------------------------------------------------| -| Commands: | | -| * Play | 0x00 | -| * Pause | 0x01 | -| * StopPlayback | 0x02 | -| * StartOver | 0x03 | -| * Previous | 0x04 | -| * Next | 0x05 | -| * Rewind | 0x06 | -| * FastForward | 0x07 | -| * SkipForward | 0x08 | -| * SkipBackward | 0x09 | -| * Seek | 0x0B | -|------------------------------------------------------------------------------| -| Attributes: | | -| * CurrentState | 0x0000 | -| * StartTime | 0x0001 | -| * Duration | 0x0002 | -| * SampledPosition | 0x0003 | -| * PlaybackSpeed | 0x0004 | -| * SeekRangeEnd | 0x0005 | -| * SeekRangeStart | 0x0006 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command Play - */ -class MediaPlaybackPlay : public ClusterCommand { -public: - MediaPlaybackPlay() - : ClusterCommand("play") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterPlayParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster playWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command Pause - */ -class MediaPlaybackPause : public ClusterCommand { -public: - MediaPlaybackPause() - : ClusterCommand("pause") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterPauseParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - pauseWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command StopPlayback - */ -class MediaPlaybackStopPlayback : public ClusterCommand { -public: - MediaPlaybackStopPlayback() - : ClusterCommand("stop-playback") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterStopPlaybackParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopPlaybackWithParams:params - completion:^( - MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command StartOver - */ -class MediaPlaybackStartOver : public ClusterCommand { -public: - MediaPlaybackStartOver() - : ClusterCommand("start-over") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterStartOverParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - startOverWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command Previous - */ -class MediaPlaybackPrevious : public ClusterCommand { -public: - MediaPlaybackPrevious() - : ClusterCommand("previous") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterPreviousParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - previousWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command Next - */ -class MediaPlaybackNext : public ClusterCommand { -public: - MediaPlaybackNext() - : ClusterCommand("next") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterNextParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster nextWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command Rewind - */ -class MediaPlaybackRewind : public ClusterCommand { -public: - MediaPlaybackRewind() - : ClusterCommand("rewind") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterRewindParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - rewindWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command FastForward - */ -class MediaPlaybackFastForward : public ClusterCommand { -public: - MediaPlaybackFastForward() - : ClusterCommand("fast-forward") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterFastForwardParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster fastForwardWithParams:params - completion:^( - MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command SkipForward - */ -class MediaPlaybackSkipForward : public ClusterCommand { -public: - MediaPlaybackSkipForward() - : ClusterCommand("skip-forward") - { - AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, &mRequest.deltaPositionMilliseconds); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterSkipForwardParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.deltaPositionMilliseconds = [NSNumber numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster skipForwardWithParams:params - completion:^( - MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type mRequest; -}; - -/* - * Command SkipBackward - */ -class MediaPlaybackSkipBackward : public ClusterCommand { -public: - MediaPlaybackSkipBackward() - : ClusterCommand("skip-backward") - { - AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, &mRequest.deltaPositionMilliseconds); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterSkipBackwardParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.deltaPositionMilliseconds = [NSNumber numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster skipBackwardWithParams:params - completion:^( - MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type mRequest; -}; - -/* - * Command Seek - */ -class MediaPlaybackSeek : public ClusterCommand { -public: - MediaPlaybackSeek() - : ClusterCommand("seek") - { - AddArgument("Position", 0, UINT64_MAX, &mRequest.position); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) command (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaPlaybackClusterSeekParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.position = [NSNumber numberWithUnsignedLongLong:mRequest.position]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster seekWithParams:params - completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::MediaPlayback::Commands::Seek::Type mRequest; -}; - -/* - * Attribute CurrentState - */ -class ReadMediaPlaybackCurrentState : public ReadAttribute { -public: - ReadMediaPlaybackCurrentState() - : ReadAttribute("current-state") - { - } - - ~ReadMediaPlaybackCurrentState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.CurrentState response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback CurrentState read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackCurrentState : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackCurrentState() - : SubscribeAttribute("current-state") - { - } - - ~SubscribeAttributeMediaPlaybackCurrentState() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentStateWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.CurrentState response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute StartTime - */ -class ReadMediaPlaybackStartTime : public ReadAttribute { -public: - ReadMediaPlaybackStartTime() - : ReadAttribute("start-time") - { - } - - ~ReadMediaPlaybackStartTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStartTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.StartTime response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback StartTime read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackStartTime : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackStartTime() - : SubscribeAttribute("start-time") - { - } - - ~SubscribeAttributeMediaPlaybackStartTime() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStartTimeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.StartTime response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Duration - */ -class ReadMediaPlaybackDuration : public ReadAttribute { -public: - ReadMediaPlaybackDuration() - : ReadAttribute("duration") - { - } - - ~ReadMediaPlaybackDuration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.Duration response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback Duration read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackDuration : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackDuration() - : SubscribeAttribute("duration") - { - } - - ~SubscribeAttributeMediaPlaybackDuration() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDurationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.Duration response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SampledPosition - */ -class ReadMediaPlaybackSampledPosition : public ReadAttribute { -public: - ReadMediaPlaybackSampledPosition() - : ReadAttribute("sampled-position") - { - } - - ~ReadMediaPlaybackSampledPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSampledPositionWithCompletion:^( - MTRMediaPlaybackClusterPlaybackPosition * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback SampledPosition read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackSampledPosition : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackSampledPosition() - : SubscribeAttribute("sampled-position") - { - } - - ~SubscribeAttributeMediaPlaybackSampledPosition() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSampledPositionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRMediaPlaybackClusterPlaybackPosition * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute PlaybackSpeed - */ -class ReadMediaPlaybackPlaybackSpeed : public ReadAttribute { -public: - ReadMediaPlaybackPlaybackSpeed() - : ReadAttribute("playback-speed") - { - } - - ~ReadMediaPlaybackPlaybackSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePlaybackSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback PlaybackSpeed read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackPlaybackSpeed : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackPlaybackSpeed() - : SubscribeAttribute("playback-speed") - { - } - - ~SubscribeAttributeMediaPlaybackPlaybackSpeed() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePlaybackSpeedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SeekRangeEnd - */ -class ReadMediaPlaybackSeekRangeEnd : public ReadAttribute { -public: - ReadMediaPlaybackSeekRangeEnd() - : ReadAttribute("seek-range-end") - { - } - - ~ReadMediaPlaybackSeekRangeEnd() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSeekRangeEndWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback SeekRangeEnd read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackSeekRangeEnd : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackSeekRangeEnd() - : SubscribeAttribute("seek-range-end") - { - } - - ~SubscribeAttributeMediaPlaybackSeekRangeEnd() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSeekRangeEndWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SeekRangeStart - */ -class ReadMediaPlaybackSeekRangeStart : public ReadAttribute { -public: - ReadMediaPlaybackSeekRangeStart() - : ReadAttribute("seek-range-start") - { - } - - ~ReadMediaPlaybackSeekRangeStart() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSeekRangeStartWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback SeekRangeStart read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackSeekRangeStart : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackSeekRangeStart() - : SubscribeAttribute("seek-range-start") - { - } - - ~SubscribeAttributeMediaPlaybackSeekRangeStart() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSeekRangeStartWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadMediaPlaybackGeneratedCommandList : public ReadAttribute { -public: - ReadMediaPlaybackGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadMediaPlaybackGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeMediaPlaybackGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadMediaPlaybackAcceptedCommandList : public ReadAttribute { -public: - ReadMediaPlaybackAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadMediaPlaybackAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeMediaPlaybackAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadMediaPlaybackAttributeList : public ReadAttribute { -public: - ReadMediaPlaybackAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadMediaPlaybackAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeMediaPlaybackAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadMediaPlaybackFeatureMap : public ReadAttribute { -public: - ReadMediaPlaybackFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadMediaPlaybackFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeMediaPlaybackFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadMediaPlaybackClusterRevision : public ReadAttribute { -public: - ReadMediaPlaybackClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadMediaPlaybackClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("MediaPlayback ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaPlaybackClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeMediaPlaybackClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeMediaPlaybackClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster MediaInput | 0x0507 | -|------------------------------------------------------------------------------| -| Commands: | | -| * SelectInput | 0x00 | -| * ShowInputStatus | 0x01 | -| * HideInputStatus | 0x02 | -| * RenameInput | 0x03 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * InputList | 0x0000 | -| * CurrentInput | 0x0001 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command SelectInput - */ -class MediaInputSelectInput : public ClusterCommand { -public: - MediaInputSelectInput() - : ClusterCommand("select-input") - { - AddArgument("Index", 0, UINT8_MAX, &mRequest.index); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaInputClusterSelectInputParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster selectInputWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::MediaInput::Commands::SelectInput::Type mRequest; -}; - -/* - * Command ShowInputStatus - */ -class MediaInputShowInputStatus : public ClusterCommand { -public: - MediaInputShowInputStatus() - : ClusterCommand("show-input-status") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaInputClusterShowInputStatusParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster showInputStatusWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command HideInputStatus - */ -class MediaInputHideInputStatus : public ClusterCommand { -public: - MediaInputHideInputStatus() - : ClusterCommand("hide-input-status") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaInputClusterHideInputStatusParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster hideInputStatusWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Command RenameInput - */ -class MediaInputRenameInput : public ClusterCommand { -public: - MediaInputRenameInput() - : ClusterCommand("rename-input") - { - AddArgument("Index", 0, UINT8_MAX, &mRequest.index); - AddArgument("Name", &mRequest.name); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRMediaInputClusterRenameInputParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; - params.name = [[NSString alloc] initWithBytes:mRequest.name.data() - length:mRequest.name.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster renameInputWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::MediaInput::Commands::RenameInput::Type mRequest; -}; - -/* - * Attribute InputList - */ -class ReadMediaInputInputList : public ReadAttribute { -public: - ReadMediaInputInputList() - : ReadAttribute("input-list") - { - } - - ~ReadMediaInputInputList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInputListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.InputList response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput InputList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputInputList : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputInputList() - : SubscribeAttribute("input-list") - { - } - - ~SubscribeAttributeMediaInputInputList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInputListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.InputList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentInput - */ -class ReadMediaInputCurrentInput : public ReadAttribute { -public: - ReadMediaInputCurrentInput() - : ReadAttribute("current-input") - { - } - - ~ReadMediaInputCurrentInput() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentInputWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.CurrentInput response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput CurrentInput read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputCurrentInput : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputCurrentInput() - : SubscribeAttribute("current-input") - { - } - - ~SubscribeAttributeMediaInputCurrentInput() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentInputWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.CurrentInput response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadMediaInputGeneratedCommandList : public ReadAttribute { -public: - ReadMediaInputGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadMediaInputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeMediaInputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadMediaInputAcceptedCommandList : public ReadAttribute { -public: - ReadMediaInputAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadMediaInputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeMediaInputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadMediaInputAttributeList : public ReadAttribute { -public: - ReadMediaInputAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadMediaInputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeMediaInputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadMediaInputFeatureMap : public ReadAttribute { -public: - ReadMediaInputFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadMediaInputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeMediaInputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadMediaInputClusterRevision : public ReadAttribute { -public: - ReadMediaInputClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadMediaInputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("MediaInput ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeMediaInputClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeMediaInputClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeMediaInputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000507) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"MediaInput.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster LowPower | 0x0508 | -|------------------------------------------------------------------------------| -| Commands: | | -| * Sleep | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command Sleep - */ -class LowPowerSleep : public ClusterCommand { -public: - LowPowerSleep() - : ClusterCommand("sleep") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRLowPowerClusterSleepParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster sleepWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadLowPowerGeneratedCommandList : public ReadAttribute { -public: - ReadLowPowerGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadLowPowerGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LowPower GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLowPowerGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeLowPowerGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeLowPowerGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadLowPowerAcceptedCommandList : public ReadAttribute { -public: - ReadLowPowerAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadLowPowerAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("LowPower AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLowPowerAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeLowPowerAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeLowPowerAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadLowPowerAttributeList : public ReadAttribute { -public: - ReadLowPowerAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadLowPowerAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("LowPower AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLowPowerAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeLowPowerAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeLowPowerAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadLowPowerFeatureMap : public ReadAttribute { -public: - ReadLowPowerFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadLowPowerFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("LowPower FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLowPowerFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeLowPowerFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeLowPowerFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadLowPowerClusterRevision : public ReadAttribute { -public: - ReadLowPowerClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadLowPowerClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("LowPower ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeLowPowerClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeLowPowerClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeLowPowerClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000508) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"LowPower.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster KeypadInput | 0x0509 | -|------------------------------------------------------------------------------| -| Commands: | | -| * SendKey | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command SendKey - */ -class KeypadInputSendKey : public ClusterCommand { -public: - KeypadInputSendKey() - : ClusterCommand("send-key") - { - AddArgument("KeyCode", 0, UINT8_MAX, &mRequest.keyCode); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRKeypadInputClusterSendKeyParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.keyCode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.keyCode)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster sendKeyWithParams:params - completion:^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::KeypadInput::Commands::SendKey::Type mRequest; -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadKeypadInputGeneratedCommandList : public ReadAttribute { -public: - ReadKeypadInputGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadKeypadInputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("KeypadInput GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeKeypadInputGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeKeypadInputGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeKeypadInputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadKeypadInputAcceptedCommandList : public ReadAttribute { -public: - ReadKeypadInputAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadKeypadInputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("KeypadInput AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeKeypadInputAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeKeypadInputAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeKeypadInputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadKeypadInputAttributeList : public ReadAttribute { -public: - ReadKeypadInputAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadKeypadInputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("KeypadInput AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeKeypadInputAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeKeypadInputAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeKeypadInputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadKeypadInputFeatureMap : public ReadAttribute { -public: - ReadKeypadInputFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadKeypadInputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("KeypadInput FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeKeypadInputFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeKeypadInputFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeKeypadInputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadKeypadInputClusterRevision : public ReadAttribute { -public: - ReadKeypadInputClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadKeypadInputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("KeypadInput ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeKeypadInputClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeKeypadInputClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeKeypadInputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000509) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ContentLauncher | 0x050A | -|------------------------------------------------------------------------------| -| Commands: | | -| * LaunchContent | 0x00 | -| * LaunchURL | 0x01 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * AcceptHeader | 0x0000 | -| * SupportedStreamingProtocols | 0x0001 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command LaunchContent - */ -class ContentLauncherLaunchContent : public ClusterCommand { -public: - ContentLauncherLaunchContent() - : ClusterCommand("launch-content") - , mComplex_Search(&mRequest.search) - { - AddArgument("Search", &mComplex_Search); - AddArgument("AutoPlay", 0, 1, &mRequest.autoPlay); - AddArgument("Data", &mRequest.data); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.search = [MTRContentLauncherClusterContentSearch new]; - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.search.parameterList) { - MTRContentLauncherClusterParameter * newElement_1; - newElement_1 = [MTRContentLauncherClusterParameter new]; - newElement_1.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.type)]; - newElement_1.value = [[NSString alloc] initWithBytes:entry_1.value.data() - length:entry_1.value.size() - encoding:NSUTF8StringEncoding]; - if (entry_1.externalIDList.HasValue()) { - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - for (auto & entry_4 : entry_1.externalIDList.Value()) { - MTRContentLauncherClusterAdditionalInfo * newElement_4; - newElement_4 = [MTRContentLauncherClusterAdditionalInfo new]; - newElement_4.name = [[NSString alloc] initWithBytes:entry_4.name.data() - length:entry_4.name.size() - encoding:NSUTF8StringEncoding]; - newElement_4.value = [[NSString alloc] initWithBytes:entry_4.value.data() - length:entry_4.value.size() - encoding:NSUTF8StringEncoding]; - [array_4 addObject:newElement_4]; - } - newElement_1.externalIDList = array_4; - } - } else { - newElement_1.externalIDList = nil; - } - [array_1 addObject:newElement_1]; - } - params.search.parameterList = array_1; - } - params.autoPlay = [NSNumber numberWithBool:mRequest.autoPlay]; - if (mRequest.data.HasValue()) { - params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() - length:mRequest.data.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.data = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster launchContentWithParams:params - completion:^( - MTRContentLauncherClusterLaunchResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type mRequest; - TypedComplexArgument mComplex_Search; -}; - -/* - * Command LaunchURL - */ -class ContentLauncherLaunchURL : public ClusterCommand { -public: - ContentLauncherLaunchURL() - : ClusterCommand("launch-url") - , mComplex_BrandingInformation(&mRequest.brandingInformation) - { - AddArgument("ContentURL", &mRequest.contentURL); - AddArgument("DisplayString", &mRequest.displayString); - AddArgument("BrandingInformation", &mComplex_BrandingInformation); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.contentURL = [[NSString alloc] initWithBytes:mRequest.contentURL.data() - length:mRequest.contentURL.size() - encoding:NSUTF8StringEncoding]; - if (mRequest.displayString.HasValue()) { - params.displayString = [[NSString alloc] initWithBytes:mRequest.displayString.Value().data() - length:mRequest.displayString.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.displayString = nil; - } - if (mRequest.brandingInformation.HasValue()) { - params.brandingInformation = [MTRContentLauncherClusterBrandingInformation new]; - params.brandingInformation.providerName = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().providerName.data() - length:mRequest.brandingInformation.Value().providerName.size() - encoding:NSUTF8StringEncoding]; - if (mRequest.brandingInformation.Value().background.HasValue()) { - params.brandingInformation.background = [MTRContentLauncherClusterStyleInformation new]; - if (mRequest.brandingInformation.Value().background.Value().imageUrl.HasValue()) { - params.brandingInformation.background.imageUrl = [[NSString alloc] - initWithBytes:mRequest.brandingInformation.Value().background.Value().imageUrl.Value().data() - length:mRequest.brandingInformation.Value().background.Value().imageUrl.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.background.imageUrl = nil; - } - if (mRequest.brandingInformation.Value().background.Value().color.HasValue()) { - params.brandingInformation.background.color = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().background.Value().color.Value().data() - length:mRequest.brandingInformation.Value().background.Value().color.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.background.color = nil; - } - if (mRequest.brandingInformation.Value().background.Value().size.HasValue()) { - params.brandingInformation.background.size = [MTRContentLauncherClusterDimension new]; - params.brandingInformation.background.size.width = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().background.Value().size.Value().width]; - params.brandingInformation.background.size.height = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().background.Value().size.Value().height]; - params.brandingInformation.background.size.metric = [NSNumber - numberWithUnsignedChar:chip::to_underlying( - mRequest.brandingInformation.Value().background.Value().size.Value().metric)]; - } else { - params.brandingInformation.background.size = nil; - } - } else { - params.brandingInformation.background = nil; - } - if (mRequest.brandingInformation.Value().logo.HasValue()) { - params.brandingInformation.logo = [MTRContentLauncherClusterStyleInformation new]; - if (mRequest.brandingInformation.Value().logo.Value().imageUrl.HasValue()) { - params.brandingInformation.logo.imageUrl = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().logo.Value().imageUrl.Value().data() - length:mRequest.brandingInformation.Value().logo.Value().imageUrl.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.logo.imageUrl = nil; - } - if (mRequest.brandingInformation.Value().logo.Value().color.HasValue()) { - params.brandingInformation.logo.color = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().logo.Value().color.Value().data() - length:mRequest.brandingInformation.Value().logo.Value().color.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.logo.color = nil; - } - if (mRequest.brandingInformation.Value().logo.Value().size.HasValue()) { - params.brandingInformation.logo.size = [MTRContentLauncherClusterDimension new]; - params.brandingInformation.logo.size.width = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().logo.Value().size.Value().width]; - params.brandingInformation.logo.size.height = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().logo.Value().size.Value().height]; - params.brandingInformation.logo.size.metric = [NSNumber - numberWithUnsignedChar:chip::to_underlying( - mRequest.brandingInformation.Value().logo.Value().size.Value().metric)]; - } else { - params.brandingInformation.logo.size = nil; - } - } else { - params.brandingInformation.logo = nil; - } - if (mRequest.brandingInformation.Value().progressBar.HasValue()) { - params.brandingInformation.progressBar = [MTRContentLauncherClusterStyleInformation new]; - if (mRequest.brandingInformation.Value().progressBar.Value().imageUrl.HasValue()) { - params.brandingInformation.progressBar.imageUrl = [[NSString alloc] - initWithBytes:mRequest.brandingInformation.Value().progressBar.Value().imageUrl.Value().data() - length:mRequest.brandingInformation.Value().progressBar.Value().imageUrl.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.progressBar.imageUrl = nil; - } - if (mRequest.brandingInformation.Value().progressBar.Value().color.HasValue()) { - params.brandingInformation.progressBar.color = [[NSString alloc] - initWithBytes:mRequest.brandingInformation.Value().progressBar.Value().color.Value().data() - length:mRequest.brandingInformation.Value().progressBar.Value().color.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.progressBar.color = nil; - } - if (mRequest.brandingInformation.Value().progressBar.Value().size.HasValue()) { - params.brandingInformation.progressBar.size = [MTRContentLauncherClusterDimension new]; - params.brandingInformation.progressBar.size.width = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().progressBar.Value().size.Value().width]; - params.brandingInformation.progressBar.size.height = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().progressBar.Value().size.Value().height]; - params.brandingInformation.progressBar.size.metric = [NSNumber - numberWithUnsignedChar:chip::to_underlying( - mRequest.brandingInformation.Value().progressBar.Value().size.Value().metric)]; - } else { - params.brandingInformation.progressBar.size = nil; - } - } else { - params.brandingInformation.progressBar = nil; - } - if (mRequest.brandingInformation.Value().splash.HasValue()) { - params.brandingInformation.splash = [MTRContentLauncherClusterStyleInformation new]; - if (mRequest.brandingInformation.Value().splash.Value().imageUrl.HasValue()) { - params.brandingInformation.splash.imageUrl = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().splash.Value().imageUrl.Value().data() - length:mRequest.brandingInformation.Value().splash.Value().imageUrl.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.splash.imageUrl = nil; - } - if (mRequest.brandingInformation.Value().splash.Value().color.HasValue()) { - params.brandingInformation.splash.color = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().splash.Value().color.Value().data() - length:mRequest.brandingInformation.Value().splash.Value().color.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.splash.color = nil; - } - if (mRequest.brandingInformation.Value().splash.Value().size.HasValue()) { - params.brandingInformation.splash.size = [MTRContentLauncherClusterDimension new]; - params.brandingInformation.splash.size.width = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().splash.Value().size.Value().width]; - params.brandingInformation.splash.size.height = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().splash.Value().size.Value().height]; - params.brandingInformation.splash.size.metric = [NSNumber - numberWithUnsignedChar:chip::to_underlying( - mRequest.brandingInformation.Value().splash.Value().size.Value().metric)]; - } else { - params.brandingInformation.splash.size = nil; - } - } else { - params.brandingInformation.splash = nil; - } - if (mRequest.brandingInformation.Value().waterMark.HasValue()) { - params.brandingInformation.waterMark = [MTRContentLauncherClusterStyleInformation new]; - if (mRequest.brandingInformation.Value().waterMark.Value().imageUrl.HasValue()) { - params.brandingInformation.waterMark.imageUrl = [[NSString alloc] - initWithBytes:mRequest.brandingInformation.Value().waterMark.Value().imageUrl.Value().data() - length:mRequest.brandingInformation.Value().waterMark.Value().imageUrl.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.waterMark.imageUrl = nil; - } - if (mRequest.brandingInformation.Value().waterMark.Value().color.HasValue()) { - params.brandingInformation.waterMark.color = - [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().waterMark.Value().color.Value().data() - length:mRequest.brandingInformation.Value().waterMark.Value().color.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.brandingInformation.waterMark.color = nil; - } - if (mRequest.brandingInformation.Value().waterMark.Value().size.HasValue()) { - params.brandingInformation.waterMark.size = [MTRContentLauncherClusterDimension new]; - params.brandingInformation.waterMark.size.width = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().waterMark.Value().size.Value().width]; - params.brandingInformation.waterMark.size.height = - [NSNumber numberWithDouble:mRequest.brandingInformation.Value().waterMark.Value().size.Value().height]; - params.brandingInformation.waterMark.size.metric = [NSNumber - numberWithUnsignedChar:chip::to_underlying( - mRequest.brandingInformation.Value().waterMark.Value().size.Value().metric)]; - } else { - params.brandingInformation.waterMark.size = nil; - } - } else { - params.brandingInformation.waterMark = nil; - } - } else { - params.brandingInformation = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - launchURLWithParams:params - completion:^(MTRContentLauncherClusterLaunchResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type mRequest; - TypedComplexArgument> - mComplex_BrandingInformation; -}; - -/* - * Attribute AcceptHeader - */ -class ReadContentLauncherAcceptHeader : public ReadAttribute { -public: - ReadContentLauncherAcceptHeader() - : ReadAttribute("accept-header") - { - } - - ~ReadContentLauncherAcceptHeader() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptHeaderWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher AcceptHeader read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherAcceptHeader : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherAcceptHeader() - : SubscribeAttribute("accept-header") - { - } - - ~SubscribeAttributeContentLauncherAcceptHeader() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptHeaderWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute SupportedStreamingProtocols - */ -class ReadContentLauncherSupportedStreamingProtocols : public ReadAttribute { -public: - ReadContentLauncherSupportedStreamingProtocols() - : ReadAttribute("supported-streaming-protocols") - { - } - - ~ReadContentLauncherSupportedStreamingProtocols() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeSupportedStreamingProtocolsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher SupportedStreamingProtocols read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteContentLauncherSupportedStreamingProtocols : public WriteAttribute { -public: - WriteContentLauncherSupportedStreamingProtocols() - : WriteAttribute("supported-streaming-protocols") - { - AddArgument("attr-name", "supported-streaming-protocols"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteContentLauncherSupportedStreamingProtocols() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster - writeAttributeSupportedStreamingProtocolsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "ContentLauncher SupportedStreamingProtocols write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint32_t mValue; -}; - -class SubscribeAttributeContentLauncherSupportedStreamingProtocols : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherSupportedStreamingProtocols() - : SubscribeAttribute("supported-streaming-protocols") - { - } - - ~SubscribeAttributeContentLauncherSupportedStreamingProtocols() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSupportedStreamingProtocolsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadContentLauncherGeneratedCommandList : public ReadAttribute { -public: - ReadContentLauncherGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadContentLauncherGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeContentLauncherGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadContentLauncherAcceptedCommandList : public ReadAttribute { -public: - ReadContentLauncherAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadContentLauncherAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeContentLauncherAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadContentLauncherAttributeList : public ReadAttribute { -public: - ReadContentLauncherAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadContentLauncherAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeContentLauncherAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadContentLauncherFeatureMap : public ReadAttribute { -public: - ReadContentLauncherFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadContentLauncherFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeContentLauncherFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadContentLauncherClusterRevision : public ReadAttribute { -public: - ReadContentLauncherClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadContentLauncherClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ContentLauncher ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeContentLauncherClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeContentLauncherClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeContentLauncherClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ContentLauncher.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster AudioOutput | 0x050B | -|------------------------------------------------------------------------------| -| Commands: | | -| * SelectOutput | 0x00 | -| * RenameOutput | 0x01 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * OutputList | 0x0000 | -| * CurrentOutput | 0x0001 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command SelectOutput - */ -class AudioOutputSelectOutput : public ClusterCommand { -public: - AudioOutputSelectOutput() - : ClusterCommand("select-output") - { - AddArgument("Index", 0, UINT8_MAX, &mRequest.index); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAudioOutputClusterSelectOutputParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster selectOutputWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type mRequest; -}; - -/* - * Command RenameOutput - */ -class AudioOutputRenameOutput : public ClusterCommand { -public: - AudioOutputRenameOutput() - : ClusterCommand("rename-output") - { - AddArgument("Index", 0, UINT8_MAX, &mRequest.index); - AddArgument("Name", &mRequest.name); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAudioOutputClusterRenameOutputParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; - params.name = [[NSString alloc] initWithBytes:mRequest.name.data() - length:mRequest.name.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster renameOutputWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type mRequest; -}; - -/* - * Attribute OutputList - */ -class ReadAudioOutputOutputList : public ReadAttribute { -public: - ReadAudioOutputOutputList() - : ReadAttribute("output-list") - { - } - - ~ReadAudioOutputOutputList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOutputListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.OutputList response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput OutputList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputOutputList : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputOutputList() - : SubscribeAttribute("output-list") - { - } - - ~SubscribeAttributeAudioOutputOutputList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOutputListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.OutputList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentOutput - */ -class ReadAudioOutputCurrentOutput : public ReadAttribute { -public: - ReadAudioOutputCurrentOutput() - : ReadAttribute("current-output") - { - } - - ~ReadAudioOutputCurrentOutput() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentOutputWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput CurrentOutput read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputCurrentOutput : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputCurrentOutput() - : SubscribeAttribute("current-output") - { - } - - ~SubscribeAttributeAudioOutputCurrentOutput() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentOutputWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadAudioOutputGeneratedCommandList : public ReadAttribute { -public: - ReadAudioOutputGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadAudioOutputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeAudioOutputGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadAudioOutputAcceptedCommandList : public ReadAttribute { -public: - ReadAudioOutputAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadAudioOutputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeAudioOutputAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadAudioOutputAttributeList : public ReadAttribute { -public: - ReadAudioOutputAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadAudioOutputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeAudioOutputAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadAudioOutputFeatureMap : public ReadAttribute { -public: - ReadAudioOutputFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadAudioOutputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeAudioOutputFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadAudioOutputClusterRevision : public ReadAttribute { -public: - ReadAudioOutputClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadAudioOutputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("AudioOutput ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAudioOutputClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeAudioOutputClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeAudioOutputClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ApplicationLauncher | 0x050C | -|------------------------------------------------------------------------------| -| Commands: | | -| * LaunchApp | 0x00 | -| * StopApp | 0x01 | -| * HideApp | 0x02 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * CatalogList | 0x0000 | -| * CurrentApp | 0x0001 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command LaunchApp - */ -class ApplicationLauncherLaunchApp : public ClusterCommand { -public: - ApplicationLauncherLaunchApp() - : ClusterCommand("launch-app") - , mComplex_Application(&mRequest.application) - { - AddArgument("Application", &mComplex_Application); - AddArgument("Data", &mRequest.data); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.application = [MTRApplicationLauncherClusterApplication new]; - params.application.catalogVendorId = [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; - params.application.applicationId = [[NSString alloc] initWithBytes:mRequest.application.applicationId.data() - length:mRequest.application.applicationId.size() - encoding:NSUTF8StringEncoding]; - if (mRequest.data.HasValue()) { - params.data = [NSData dataWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size()]; - } else { - params.data = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster launchAppWithParams:params - completion:^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type mRequest; - TypedComplexArgument mComplex_Application; -}; - -/* - * Command StopApp - */ -class ApplicationLauncherStopApp : public ClusterCommand { -public: - ApplicationLauncherStopApp() - : ClusterCommand("stop-app") - , mComplex_Application(&mRequest.application) - { - AddArgument("Application", &mComplex_Application); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRApplicationLauncherClusterStopAppParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.application = [MTRApplicationLauncherClusterApplication new]; - params.application.catalogVendorId = [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; - params.application.applicationId = [[NSString alloc] initWithBytes:mRequest.application.applicationId.data() - length:mRequest.application.applicationId.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster stopAppWithParams:params - completion:^( - MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type mRequest; - TypedComplexArgument mComplex_Application; -}; - -/* - * Command HideApp - */ -class ApplicationLauncherHideApp : public ClusterCommand { -public: - ApplicationLauncherHideApp() - : ClusterCommand("hide-app") - , mComplex_Application(&mRequest.application) - { - AddArgument("Application", &mComplex_Application); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRApplicationLauncherClusterHideAppParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.application = [MTRApplicationLauncherClusterApplication new]; - params.application.catalogVendorId = [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; - params.application.applicationId = [[NSString alloc] initWithBytes:mRequest.application.applicationId.data() - length:mRequest.application.applicationId.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster hideAppWithParams:params - completion:^( - MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type mRequest; - TypedComplexArgument mComplex_Application; -}; - -/* - * Attribute CatalogList - */ -class ReadApplicationLauncherCatalogList : public ReadAttribute { -public: - ReadApplicationLauncherCatalogList() - : ReadAttribute("catalog-list") - { - } - - ~ReadApplicationLauncherCatalogList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCatalogListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.CatalogList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher CatalogList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherCatalogList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherCatalogList() - : SubscribeAttribute("catalog-list") - { - } - - ~SubscribeAttributeApplicationLauncherCatalogList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCatalogListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.CatalogList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute CurrentApp - */ -class ReadApplicationLauncherCurrentApp : public ReadAttribute { -public: - ReadApplicationLauncherCurrentApp() - : ReadAttribute("current-app") - { - } - - ~ReadApplicationLauncherCurrentApp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentAppWithCompletion:^( - MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher CurrentApp read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteApplicationLauncherCurrentApp : public WriteAttribute { -public: - WriteApplicationLauncherCurrentApp() - : WriteAttribute("current-app") - , mComplex(&mValue) - { - AddArgument("attr-name", "current-app"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteApplicationLauncherCurrentApp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - MTRApplicationLauncherClusterApplicationEP * _Nullable value; - if (mValue.IsNull()) { - value = nil; - } else { - value = [MTRApplicationLauncherClusterApplicationEP new]; - value.application = [MTRApplicationLauncherClusterApplication new]; - value.application.catalogVendorId = [NSNumber numberWithUnsignedShort:mValue.Value().application.catalogVendorId]; - value.application.applicationId = [[NSString alloc] initWithBytes:mValue.Value().application.applicationId.data() - length:mValue.Value().application.applicationId.size() - encoding:NSUTF8StringEncoding]; - if (mValue.Value().endpoint.HasValue()) { - value.endpoint = [NSNumber numberWithUnsignedShort:mValue.Value().endpoint.Value()]; - } else { - value.endpoint = nil; - } - } - - [cluster writeAttributeCurrentAppWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ApplicationLauncher CurrentApp write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - chip::app::DataModel::Nullable mValue; - TypedComplexArgument> - mComplex; -}; - -class SubscribeAttributeApplicationLauncherCurrentApp : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherCurrentApp() - : SubscribeAttribute("current-app") - { - } - - ~SubscribeAttributeApplicationLauncherCurrentApp() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCurrentAppWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadApplicationLauncherGeneratedCommandList : public ReadAttribute { -public: - ReadApplicationLauncherGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadApplicationLauncherGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeApplicationLauncherGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadApplicationLauncherAcceptedCommandList : public ReadAttribute { -public: - ReadApplicationLauncherAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadApplicationLauncherAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeApplicationLauncherAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadApplicationLauncherAttributeList : public ReadAttribute { -public: - ReadApplicationLauncherAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadApplicationLauncherAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeApplicationLauncherAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadApplicationLauncherFeatureMap : public ReadAttribute { -public: - ReadApplicationLauncherFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadApplicationLauncherFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeApplicationLauncherFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadApplicationLauncherClusterRevision : public ReadAttribute { -public: - ReadApplicationLauncherClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadApplicationLauncherClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationLauncher ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationLauncherClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeApplicationLauncherClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeApplicationLauncherClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationLauncher.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ApplicationBasic | 0x050D | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * VendorName | 0x0000 | -| * VendorID | 0x0001 | -| * ApplicationName | 0x0002 | -| * ProductID | 0x0003 | -| * Application | 0x0004 | -| * Status | 0x0005 | -| * ApplicationVersion | 0x0006 | -| * AllowedVendorList | 0x0007 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Attribute VendorName - */ -class ReadApplicationBasicVendorName : public ReadAttribute { -public: - ReadApplicationBasicVendorName() - : ReadAttribute("vendor-name") - { - } - - ~ReadApplicationBasicVendorName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.VendorName response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic VendorName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicVendorName : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicVendorName() - : SubscribeAttribute("vendor-name") - { - } - - ~SubscribeAttributeApplicationBasicVendorName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVendorNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.VendorName response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute VendorID - */ -class ReadApplicationBasicVendorID : public ReadAttribute { -public: - ReadApplicationBasicVendorID() - : ReadAttribute("vendor-id") - { - } - - ~ReadApplicationBasicVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.VendorID response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic VendorID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicVendorID : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicVendorID() - : SubscribeAttribute("vendor-id") - { - } - - ~SubscribeAttributeApplicationBasicVendorID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVendorIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.VendorID response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ApplicationName - */ -class ReadApplicationBasicApplicationName : public ReadAttribute { -public: - ReadApplicationBasicApplicationName() - : ReadAttribute("application-name") - { - } - - ~ReadApplicationBasicApplicationName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApplicationNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ApplicationName response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic ApplicationName read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicApplicationName : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicApplicationName() - : SubscribeAttribute("application-name") - { - } - - ~SubscribeAttributeApplicationBasicApplicationName() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApplicationNameWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ApplicationName response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ProductID - */ -class ReadApplicationBasicProductID : public ReadAttribute { -public: - ReadApplicationBasicProductID() - : ReadAttribute("product-id") - { - } - - ~ReadApplicationBasicProductID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ProductID response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic ProductID read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicProductID : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicProductID() - : SubscribeAttribute("product-id") - { - } - - ~SubscribeAttributeApplicationBasicProductID() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeProductIDWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ProductID response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Application - */ -class ReadApplicationBasicApplication : public ReadAttribute { -public: - ReadApplicationBasicApplication() - : ReadAttribute("application") - { - } - - ~ReadApplicationBasicApplication() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApplicationWithCompletion:^( - MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.Application response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic Application read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicApplication : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicApplication() - : SubscribeAttribute("application") - { - } - - ~SubscribeAttributeApplicationBasicApplication() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApplicationWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.Application response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute Status - */ -class ReadApplicationBasicStatus : public ReadAttribute { -public: - ReadApplicationBasicStatus() - : ReadAttribute("status") - { - } - - ~ReadApplicationBasicStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.Status response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic Status read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicStatus : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicStatus() - : SubscribeAttribute("status") - { - } - - ~SubscribeAttributeApplicationBasicStatus() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeStatusWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.Status response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ApplicationVersion - */ -class ReadApplicationBasicApplicationVersion : public ReadAttribute { -public: - ReadApplicationBasicApplicationVersion() - : ReadAttribute("application-version") - { - } - - ~ReadApplicationBasicApplicationVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApplicationVersionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ApplicationVersion response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic ApplicationVersion read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicApplicationVersion : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicApplicationVersion() - : SubscribeAttribute("application-version") - { - } - - ~SubscribeAttributeApplicationBasicApplicationVersion() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApplicationVersionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ApplicationVersion response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AllowedVendorList - */ -class ReadApplicationBasicAllowedVendorList : public ReadAttribute { -public: - ReadApplicationBasicAllowedVendorList() - : ReadAttribute("allowed-vendor-list") - { - } - - ~ReadApplicationBasicAllowedVendorList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAllowedVendorListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AllowedVendorList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic AllowedVendorList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicAllowedVendorList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicAllowedVendorList() - : SubscribeAttribute("allowed-vendor-list") - { - } - - ~SubscribeAttributeApplicationBasicAllowedVendorList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAllowedVendorListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AllowedVendorList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadApplicationBasicGeneratedCommandList : public ReadAttribute { -public: - ReadApplicationBasicGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadApplicationBasicGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeApplicationBasicGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadApplicationBasicAcceptedCommandList : public ReadAttribute { -public: - ReadApplicationBasicAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadApplicationBasicAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeApplicationBasicAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadApplicationBasicAttributeList : public ReadAttribute { -public: - ReadApplicationBasicAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadApplicationBasicAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeApplicationBasicAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadApplicationBasicFeatureMap : public ReadAttribute { -public: - ReadApplicationBasicFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadApplicationBasicFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeApplicationBasicFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadApplicationBasicClusterRevision : public ReadAttribute { -public: - ReadApplicationBasicClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadApplicationBasicClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ApplicationBasic ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeApplicationBasicClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeApplicationBasicClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeApplicationBasicClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ApplicationBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster AccountLogin | 0x050E | -|------------------------------------------------------------------------------| -| Commands: | | -| * GetSetupPIN | 0x00 | -| * Login | 0x02 | -| * Logout | 0x03 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command GetSetupPIN - */ -class AccountLoginGetSetupPIN : public ClusterCommand { -public: - AccountLoginGetSetupPIN() - : ClusterCommand("get-setup-pin") - { - AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAccountLoginClusterGetSetupPINParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.tempAccountIdentifier = [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() - length:mRequest.tempAccountIdentifier.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getSetupPINWithParams:params - completion:^( - MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable values, NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type mRequest; -}; - -/* - * Command Login - */ -class AccountLoginLogin : public ClusterCommand { -public: - AccountLoginLogin() - : ClusterCommand("login") - { - AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); - AddArgument("SetupPIN", &mRequest.setupPIN); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAccountLoginClusterLoginParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.tempAccountIdentifier = [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() - length:mRequest.tempAccountIdentifier.size() - encoding:NSUTF8StringEncoding]; - params.setupPIN = [[NSString alloc] initWithBytes:mRequest.setupPIN.data() - length:mRequest.setupPIN.size() - encoding:NSUTF8StringEncoding]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster loginWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::AccountLogin::Commands::Login::Type mRequest; -}; - -/* - * Command Logout - */ -class AccountLoginLogout : public ClusterCommand { -public: - AccountLoginLogout() - : ClusterCommand("logout") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRAccountLoginClusterLogoutParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster logoutWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; - -/* - * Attribute GeneratedCommandList - */ -class ReadAccountLoginGeneratedCommandList : public ReadAttribute { -public: - ReadAccountLoginGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadAccountLoginGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AccountLogin GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAccountLoginGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAccountLoginGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeAccountLoginGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AcceptedCommandList - */ -class ReadAccountLoginAcceptedCommandList : public ReadAttribute { -public: - ReadAccountLoginAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadAccountLoginAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("AccountLogin AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAccountLoginAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeAccountLoginAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeAccountLoginAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute AttributeList - */ -class ReadAccountLoginAttributeList : public ReadAttribute { -public: - ReadAccountLoginAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadAccountLoginAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("AccountLogin AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAccountLoginAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeAccountLoginAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeAccountLoginAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute FeatureMap - */ -class ReadAccountLoginFeatureMap : public ReadAttribute { -public: - ReadAccountLoginFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadAccountLoginFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("AccountLogin FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAccountLoginFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeAccountLoginFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeAccountLoginFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/* - * Attribute ClusterRevision - */ -class ReadAccountLoginClusterRevision : public ReadAttribute { -public: - ReadAccountLoginClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadAccountLoginClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("AccountLogin ClusterRevision read Error", error); - } - SetCommandExitStatus(error); + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", + [value description]); + SetCommandExitStatus(error); }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeAccountLoginClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeAccountLoginClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeAccountLoginClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -/*----------------------------------------------------------------------------*\ -| Cluster ElectricalMeasurement | 0x0B04 | -|------------------------------------------------------------------------------| -| Commands: | | -| * GetProfileInfoCommand | 0x00 | -| * GetMeasurementProfileCommand | 0x01 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * MeasurementType | 0x0000 | -| * DcVoltage | 0x0100 | -| * DcVoltageMin | 0x0101 | -| * DcVoltageMax | 0x0102 | -| * DcCurrent | 0x0103 | -| * DcCurrentMin | 0x0104 | -| * DcCurrentMax | 0x0105 | -| * DcPower | 0x0106 | -| * DcPowerMin | 0x0107 | -| * DcPowerMax | 0x0108 | -| * DcVoltageMultiplier | 0x0200 | -| * DcVoltageDivisor | 0x0201 | -| * DcCurrentMultiplier | 0x0202 | -| * DcCurrentDivisor | 0x0203 | -| * DcPowerMultiplier | 0x0204 | -| * DcPowerDivisor | 0x0205 | -| * AcFrequency | 0x0300 | -| * AcFrequencyMin | 0x0301 | -| * AcFrequencyMax | 0x0302 | -| * NeutralCurrent | 0x0303 | -| * TotalActivePower | 0x0304 | -| * TotalReactivePower | 0x0305 | -| * TotalApparentPower | 0x0306 | -| * Measured1stHarmonicCurrent | 0x0307 | -| * Measured3rdHarmonicCurrent | 0x0308 | -| * Measured5thHarmonicCurrent | 0x0309 | -| * Measured7thHarmonicCurrent | 0x030A | -| * Measured9thHarmonicCurrent | 0x030B | -| * Measured11thHarmonicCurrent | 0x030C | -| * MeasuredPhase1stHarmonicCurrent | 0x030D | -| * MeasuredPhase3rdHarmonicCurrent | 0x030E | -| * MeasuredPhase5thHarmonicCurrent | 0x030F | -| * MeasuredPhase7thHarmonicCurrent | 0x0310 | -| * MeasuredPhase9thHarmonicCurrent | 0x0311 | -| * MeasuredPhase11thHarmonicCurrent | 0x0312 | -| * AcFrequencyMultiplier | 0x0400 | -| * AcFrequencyDivisor | 0x0401 | -| * PowerMultiplier | 0x0402 | -| * PowerDivisor | 0x0403 | -| * HarmonicCurrentMultiplier | 0x0404 | -| * PhaseHarmonicCurrentMultiplier | 0x0405 | -| * InstantaneousVoltage | 0x0500 | -| * InstantaneousLineCurrent | 0x0501 | -| * InstantaneousActiveCurrent | 0x0502 | -| * InstantaneousReactiveCurrent | 0x0503 | -| * InstantaneousPower | 0x0504 | -| * RmsVoltage | 0x0505 | -| * RmsVoltageMin | 0x0506 | -| * RmsVoltageMax | 0x0507 | -| * RmsCurrent | 0x0508 | -| * RmsCurrentMin | 0x0509 | -| * RmsCurrentMax | 0x050A | -| * ActivePower | 0x050B | -| * ActivePowerMin | 0x050C | -| * ActivePowerMax | 0x050D | -| * ReactivePower | 0x050E | -| * ApparentPower | 0x050F | -| * PowerFactor | 0x0510 | -| * AverageRmsVoltageMeasurementPeriod | 0x0511 | -| * AverageRmsUnderVoltageCounter | 0x0513 | -| * RmsExtremeOverVoltagePeriod | 0x0514 | -| * RmsExtremeUnderVoltagePeriod | 0x0515 | -| * RmsVoltageSagPeriod | 0x0516 | -| * RmsVoltageSwellPeriod | 0x0517 | -| * AcVoltageMultiplier | 0x0600 | -| * AcVoltageDivisor | 0x0601 | -| * AcCurrentMultiplier | 0x0602 | -| * AcCurrentDivisor | 0x0603 | -| * AcPowerMultiplier | 0x0604 | -| * AcPowerDivisor | 0x0605 | -| * OverloadAlarmsMask | 0x0700 | -| * VoltageOverload | 0x0701 | -| * CurrentOverload | 0x0702 | -| * AcOverloadAlarmsMask | 0x0800 | -| * AcVoltageOverload | 0x0801 | -| * AcCurrentOverload | 0x0802 | -| * AcActivePowerOverload | 0x0803 | -| * AcReactivePowerOverload | 0x0804 | -| * AverageRmsOverVoltage | 0x0805 | -| * AverageRmsUnderVoltage | 0x0806 | -| * RmsExtremeOverVoltage | 0x0807 | -| * RmsExtremeUnderVoltage | 0x0808 | -| * RmsVoltageSag | 0x0809 | -| * RmsVoltageSwell | 0x080A | -| * LineCurrentPhaseB | 0x0901 | -| * ActiveCurrentPhaseB | 0x0902 | -| * ReactiveCurrentPhaseB | 0x0903 | -| * RmsVoltagePhaseB | 0x0905 | -| * RmsVoltageMinPhaseB | 0x0906 | -| * RmsVoltageMaxPhaseB | 0x0907 | -| * RmsCurrentPhaseB | 0x0908 | -| * RmsCurrentMinPhaseB | 0x0909 | -| * RmsCurrentMaxPhaseB | 0x090A | -| * ActivePowerPhaseB | 0x090B | -| * ActivePowerMinPhaseB | 0x090C | -| * ActivePowerMaxPhaseB | 0x090D | -| * ReactivePowerPhaseB | 0x090E | -| * ApparentPowerPhaseB | 0x090F | -| * PowerFactorPhaseB | 0x0910 | -| * AverageRmsVoltageMeasurementPeriodPhaseB | 0x0911 | -| * AverageRmsOverVoltageCounterPhaseB | 0x0912 | -| * AverageRmsUnderVoltageCounterPhaseB | 0x0913 | -| * RmsExtremeOverVoltagePeriodPhaseB | 0x0914 | -| * RmsExtremeUnderVoltagePeriodPhaseB | 0x0915 | -| * RmsVoltageSagPeriodPhaseB | 0x0916 | -| * RmsVoltageSwellPeriodPhaseB | 0x0917 | -| * LineCurrentPhaseC | 0x0A01 | -| * ActiveCurrentPhaseC | 0x0A02 | -| * ReactiveCurrentPhaseC | 0x0A03 | -| * RmsVoltagePhaseC | 0x0A05 | -| * RmsVoltageMinPhaseC | 0x0A06 | -| * RmsVoltageMaxPhaseC | 0x0A07 | -| * RmsCurrentPhaseC | 0x0A08 | -| * RmsCurrentMinPhaseC | 0x0A09 | -| * RmsCurrentMaxPhaseC | 0x0A0A | -| * ActivePowerPhaseC | 0x0A0B | -| * ActivePowerMinPhaseC | 0x0A0C | -| * ActivePowerMaxPhaseC | 0x0A0D | -| * ReactivePowerPhaseC | 0x0A0E | -| * ApparentPowerPhaseC | 0x0A0F | -| * PowerFactorPhaseC | 0x0A10 | -| * AverageRmsVoltageMeasurementPeriodPhaseC | 0x0A11 | -| * AverageRmsOverVoltageCounterPhaseC | 0x0A12 | -| * AverageRmsUnderVoltageCounterPhaseC | 0x0A13 | -| * RmsExtremeOverVoltagePeriodPhaseC | 0x0A14 | -| * RmsExtremeUnderVoltagePeriodPhaseC | 0x0A15 | -| * RmsVoltageSagPeriodPhaseC | 0x0A16 | -| * RmsVoltageSwellPeriodPhaseC | 0x0A17 | -| * GeneratedCommandList | 0xFFF8 | -| * AcceptedCommandList | 0xFFF9 | -| * AttributeList | 0xFFFB | -| * FeatureMap | 0xFFFC | -| * ClusterRevision | 0xFFFD | -|------------------------------------------------------------------------------| -| Events: | | -\*----------------------------------------------------------------------------*/ - -/* - * Command GetProfileInfoCommand - */ -class ElectricalMeasurementGetProfileInfoCommand : public ClusterCommand { -public: - ElectricalMeasurementGetProfileInfoCommand() - : ClusterCommand("get-profile-info-command") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRElectricalMeasurementClusterGetProfileInfoCommandParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getProfileInfoCommandWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: -}; -/* - * Command GetMeasurementProfileCommand - */ -class ElectricalMeasurementGetMeasurementProfileCommand : public ClusterCommand { -public: - ElectricalMeasurementGetMeasurementProfileCommand() - : ClusterCommand("get-measurement-profile-command") - { - AddArgument("AttributeId", 0, UINT16_MAX, &mRequest.attributeId); - AddArgument("StartTime", 0, UINT32_MAX, &mRequest.startTime); - AddArgument("NumberOfIntervals", 0, UINT8_MAX, &mRequest.numberOfIntervals); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.attributeId = [NSNumber numberWithUnsignedShort:mRequest.attributeId]; - params.startTime = [NSNumber numberWithUnsignedInt:mRequest.startTime]; - params.numberOfIntervals = [NSNumber numberWithUnsignedChar:mRequest.numberOfIntervals]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster getMeasurementProfileCommandWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::ElectricalMeasurement::Commands::GetMeasurementProfileCommand::Type mRequest; + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasurementType + * Attribute PirUnoccupiedToOccupiedThreshold */ -class ReadElectricalMeasurementMeasurementType : public ReadAttribute { -public: - ReadElectricalMeasurementMeasurementType() - : ReadAttribute("measurement-type") - { - } - - ~ReadElectricalMeasurementMeasurementType() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000000) on endpoint %u", endpointId); +class ReadOccupancySensingPirUnoccupiedToOccupiedThreshold + : public ReadAttribute { +public: + ReadOccupancySensingPirUnoccupiedToOccupiedThreshold() + : ReadAttribute("pir-unoccupied-to-occupied-threshold") {} + + ~ReadOccupancySensingPirUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePIRUnoccupiedToOccupiedThresholdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", + [value description]); + if (error != nil) { + LogNSError( + "OccupancySensing PIRUnoccupiedToOccupiedThreshold read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPirUnoccupiedToOccupiedThreshold + : public WriteAttribute { +public: + WriteOccupancySensingPirUnoccupiedToOccupiedThreshold() + : WriteAttribute("pir-unoccupied-to-occupied-threshold") { + AddArgument("attr-name", "pir-unoccupied-to-occupied-threshold"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPirUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributePIRUnoccupiedToOccupiedThresholdWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "OccupancySensing " + "PIRUnoccupiedToOc" + "cupiedThreshold " + "write Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasurementTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasurementType response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasurementType read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeElectricalMeasurementMeasurementType : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasurementType() - : SubscribeAttribute("measurement-type") - { - } + SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold() + : SubscribeAttribute("pir-unoccupied-to-occupied-threshold") {} - ~SubscribeAttributeElectricalMeasurementMeasurementType() {} + ~SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePIRUnoccupiedToOccupiedThresholdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasurementTypeWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasurementType response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcVoltage + * Attribute UltrasonicOccupiedToUnoccupiedDelay */ -class ReadElectricalMeasurementDcVoltage : public ReadAttribute { -public: - ReadElectricalMeasurementDcVoltage() - : ReadAttribute("dc-voltage") - { - } - - ~ReadElectricalMeasurementDcVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000100) on endpoint %u", endpointId); +class ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay + : public ReadAttribute { +public: + ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() + : ReadAttribute("ultrasonic-occupied-to-unoccupied-delay") {} + + ~ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUltrasonicOccupiedToUnoccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay response %@", + [value description]); + if (error != nil) { + LogNSError( + "OccupancySensing UltrasonicOccupiedToUnoccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() + : WriteAttribute("ultrasonic-occupied-to-unoccupied-delay") { + AddArgument("attr-name", "ultrasonic-occupied-to-unoccupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "OccupancySensi" + "ng " + "UltrasonicOccu" + "piedToUnoccupi" + "edDelay write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcVoltage : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcVoltage() - : SubscribeAttribute("dc-voltage") - { - } + SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() + : SubscribeAttribute("ultrasonic-occupied-to-unoccupied-delay") {} - ~SubscribeAttributeElectricalMeasurementDcVoltage() {} + ~SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000100) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeUltrasonicOccupiedToUnoccupiedDelayWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcVoltageMin + * Attribute UltrasonicUnoccupiedToOccupiedDelay */ -class ReadElectricalMeasurementDcVoltageMin : public ReadAttribute { -public: - ReadElectricalMeasurementDcVoltageMin() - : ReadAttribute("dc-voltage-min") - { - } - - ~ReadElectricalMeasurementDcVoltageMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000101) on endpoint %u", endpointId); +class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay + : public ReadAttribute { +public: + ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() + : ReadAttribute("ultrasonic-unoccupied-to-occupied-delay") {} + + ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUltrasonicUnoccupiedToOccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay response %@", + [value description]); + if (error != nil) { + LogNSError( + "OccupancySensing UltrasonicUnoccupiedToOccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() + : WriteAttribute("ultrasonic-unoccupied-to-occupied-delay") { + AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "OccupancySensi" + "ng " + "UltrasonicUnoc" + "cupiedToOccupi" + "edDelay write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcVoltageMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcVoltageMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcVoltageMin : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcVoltageMin() - : SubscribeAttribute("dc-voltage-min") - { - } + SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() + : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-delay") {} - ~SubscribeAttributeElectricalMeasurementDcVoltageMin() {} + ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000101) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeUltrasonicUnoccupiedToOccupiedDelayWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcVoltageMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcVoltageMax + * Attribute UltrasonicUnoccupiedToOccupiedThreshold */ -class ReadElectricalMeasurementDcVoltageMax : public ReadAttribute { -public: - ReadElectricalMeasurementDcVoltageMax() - : ReadAttribute("dc-voltage-max") - { - } - - ~ReadElectricalMeasurementDcVoltageMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000102) on endpoint %u", endpointId); +class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold + : public ReadAttribute { +public: + ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() + : ReadAttribute("ultrasonic-unoccupied-to-occupied-threshold") {} + + ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeUltrasonicUnoccupiedToOccupiedThresholdWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing " + "UltrasonicUnoccupiedToOccupiedThreshold read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold + : public WriteAttribute { +public: + WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() + : WriteAttribute("ultrasonic-unoccupied-to-occupied-threshold") { + AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-threshold"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != + nil) { + LogNSError( + "OccupancyS" + "ensing " + "Ultrasonic" + "Unoccupied" + "ToOccupied" + "Threshold " + "write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcVoltageMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcVoltageMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcVoltageMax : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcVoltageMax() - : SubscribeAttribute("dc-voltage-max") - { - } + SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() + : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-threshold") {} - ~SubscribeAttributeElectricalMeasurementDcVoltageMax() {} + ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() { + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000102) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcVoltageMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcCurrent + * Attribute PhysicalContactOccupiedToUnoccupiedDelay */ -class ReadElectricalMeasurementDcCurrent : public ReadAttribute { -public: - ReadElectricalMeasurementDcCurrent() - : ReadAttribute("dc-current") - { - } - - ~ReadElectricalMeasurementDcCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000103) on endpoint %u", endpointId); +class ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay + : public ReadAttribute { +public: + ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() + : ReadAttribute("physical-contact-occupied-to-unoccupied-delay") {} + + ~ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributePhysicalContactOccupiedToUnoccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing " + "PhysicalContactOccupiedToUnoccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() + : WriteAttribute("physical-contact-occupied-to-unoccupied-delay") { + AddArgument("attr-name", "physical-contact-occupied-to-unoccupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != + nil) { + LogNSError( + "Occupancy" + "Sensing " + "PhysicalC" + "ontactOcc" + "upiedToUn" + "occupiedD" + "elay " + "write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcCurrent : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcCurrent() - : SubscribeAttribute("dc-current") - { - } + SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() + : SubscribeAttribute("physical-contact-occupied-to-unoccupied-delay") {} - ~SubscribeAttributeElectricalMeasurementDcCurrent() {} + ~SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() { + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000103) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributePhysicalContactOccupiedToUnoccupiedDelayWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcCurrentMin + * Attribute PhysicalContactUnoccupiedToOccupiedDelay */ -class ReadElectricalMeasurementDcCurrentMin : public ReadAttribute { -public: - ReadElectricalMeasurementDcCurrentMin() - : ReadAttribute("dc-current-min") - { - } - - ~ReadElectricalMeasurementDcCurrentMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000104) on endpoint %u", endpointId); +class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay + : public ReadAttribute { +public: + ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() + : ReadAttribute("physical-contact-unoccupied-to-occupied-delay") {} + + ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributePhysicalContactUnoccupiedToOccupiedDelayWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing " + "PhysicalContactUnoccupiedToOccupiedDelay read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay + : public WriteAttribute { +public: + WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() + : WriteAttribute("physical-contact-unoccupied-to-occupied-delay") { + AddArgument("attr-name", "physical-contact-unoccupied-to-occupied-delay"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != + nil) { + LogNSError( + "Occupancy" + "Sensing " + "PhysicalC" + "ontactUno" + "ccupiedTo" + "OccupiedD" + "elay " + "write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcCurrentMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcCurrentMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcCurrentMin : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcCurrentMin() - : SubscribeAttribute("dc-current-min") - { - } + SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() + : SubscribeAttribute("physical-contact-unoccupied-to-occupied-delay") {} - ~SubscribeAttributeElectricalMeasurementDcCurrentMin() {} + ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() { + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000104) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributePhysicalContactUnoccupiedToOccupiedDelayWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcCurrentMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcCurrentMax + * Attribute PhysicalContactUnoccupiedToOccupiedThreshold */ -class ReadElectricalMeasurementDcCurrentMax : public ReadAttribute { -public: - ReadElectricalMeasurementDcCurrentMax() - : ReadAttribute("dc-current-max") - { - } - - ~ReadElectricalMeasurementDcCurrentMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000105) on endpoint %u", endpointId); +class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold + : public ReadAttribute { +public: + ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() + : ReadAttribute("physical-contact-unoccupied-to-occupied-threshold") {} + + ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributePhysicalContactUnoccupiedToOccupiedThresholdWithCompletion: + ^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing." + @"PhysicalContactUnoccupiedToOccupiedThreshold response %@", + [value description]); + if (error != nil) { + LogNSError( + "OccupancySensing " + "PhysicalContactUnoccupiedToOccupiedThreshold read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold + : public WriteAttribute { +public: + WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() + : WriteAttribute("physical-contact-unoccupied-to-occupied-threshold") { + AddArgument("attr-name", + "physical-contact-unoccupied-to-occupied-threshold"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) WriteAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue: + value + params: + params + completion:^( + NSError + *_Nullable error) { + if (error != + nil) { + LogNSError( + "Occup" + "ancyS" + "ensin" + "g " + "Physi" + "calCo" + "ntact" + "Unocc" + "upied" + "ToOcc" + "upied" + "Thres" + "hold " + "write" + " Erro" + "r", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcCurrentMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcCurrentMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeElectricalMeasurementDcCurrentMax : public SubscribeAttribute { +class + SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcCurrentMax() - : SubscribeAttribute("dc-current-max") - { - } + SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() + : SubscribeAttribute( + "physical-contact-unoccupied-to-occupied-threshold") {} - ~SubscribeAttributeElectricalMeasurementDcCurrentMax() {} + ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() { + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000105) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcCurrentMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing." + @"PhysicalContactUnoccupiedToOccupiedThreshold response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcPower + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementDcPower : public ReadAttribute { +class ReadOccupancySensingGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementDcPower() - : ReadAttribute("dc-power") - { - } + ReadOccupancySensingGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadOccupancySensingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeOccupancySensingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementDcPower() {} +/* + * Attribute AcceptedCommandList + */ +class ReadOccupancySensingAcceptedCommandList : public ReadAttribute { +public: + ReadOccupancySensingAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadOccupancySensingAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeOccupancySensingAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000106) on endpoint %u", endpointId); +/* + * Attribute AttributeList + */ +class ReadOccupancySensingAttributeList : public ReadAttribute { +public: + ReadOccupancySensingAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadOccupancySensingAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("OccupancySensing AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeOccupancySensingAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcPower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadOccupancySensingFeatureMap : public ReadAttribute { +public: + ReadOccupancySensingFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadOccupancySensingFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"OccupancySensing.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("OccupancySensing FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcPower : public SubscribeAttribute { +class SubscribeAttributeOccupancySensingFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcPower() - : SubscribeAttribute("dc-power") - { - } + SubscribeAttributeOccupancySensingFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementDcPower() {} + ~SubscribeAttributeOccupancySensingFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000106) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcPowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPower response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcPowerMin + * Attribute ClusterRevision */ -class ReadElectricalMeasurementDcPowerMin : public ReadAttribute { +class ReadOccupancySensingClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementDcPowerMin() - : ReadAttribute("dc-power-min") - { - } - - ~ReadElectricalMeasurementDcPowerMin() {} + ReadOccupancySensingClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadOccupancySensingClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("OccupancySensing ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeOccupancySensingClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000406) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"OccupancySensing.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000107) on endpoint %u", endpointId); +/*----------------------------------------------------------------------------*\ +| Cluster WakeOnLan | 0x0503 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MACAddress | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcPowerMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcPowerMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute MACAddress + */ +class ReadWakeOnLanMACAddress : public ReadAttribute { +public: + ReadWakeOnLanMACAddress() : ReadAttribute("macaddress") {} + + ~ReadWakeOnLanMACAddress() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMACAddressWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN MACAddress read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcPowerMin : public SubscribeAttribute { +class SubscribeAttributeWakeOnLanMACAddress : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcPowerMin() - : SubscribeAttribute("dc-power-min") - { - } - - ~SubscribeAttributeElectricalMeasurementDcPowerMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000107) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDcPowerMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + SubscribeAttributeWakeOnLanMACAddress() : SubscribeAttribute("macaddress") {} - return CHIP_NO_ERROR; + ~SubscribeAttributeWakeOnLanMACAddress() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMACAddressWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute DcPowerMax + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementDcPowerMax : public ReadAttribute { +class ReadWakeOnLanGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementDcPowerMax() - : ReadAttribute("dc-power-max") - { - } - - ~ReadElectricalMeasurementDcPowerMax() {} + ReadWakeOnLanGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadWakeOnLanGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWakeOnLanGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWakeOnLanGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeWakeOnLanGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000108) on endpoint %u", endpointId); +/* + * Attribute AcceptedCommandList + */ +class ReadWakeOnLanAcceptedCommandList : public ReadAttribute { +public: + ReadWakeOnLanAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadWakeOnLanAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWakeOnLanAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeWakeOnLanAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeWakeOnLanAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcPowerMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcPowerMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadWakeOnLanAttributeList : public ReadAttribute { +public: + ReadWakeOnLanAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadWakeOnLanAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcPowerMax : public SubscribeAttribute { +class SubscribeAttributeWakeOnLanAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcPowerMax() - : SubscribeAttribute("dc-power-max") - { - } + SubscribeAttributeWakeOnLanAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementDcPowerMax() {} + ~SubscribeAttributeWakeOnLanAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000108) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcPowerMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcVoltageMultiplier + * Attribute FeatureMap */ -class ReadElectricalMeasurementDcVoltageMultiplier : public ReadAttribute { +class ReadWakeOnLanFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementDcVoltageMultiplier() - : ReadAttribute("dc-voltage-multiplier") - { - } - - ~ReadElectricalMeasurementDcVoltageMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000200) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcVoltageMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcVoltageMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWakeOnLanFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadWakeOnLanFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcVoltageMultiplier : public SubscribeAttribute { +class SubscribeAttributeWakeOnLanFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcVoltageMultiplier() - : SubscribeAttribute("dc-voltage-multiplier") - { - } + SubscribeAttributeWakeOnLanFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementDcVoltageMultiplier() {} + ~SubscribeAttributeWakeOnLanFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000200) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcVoltageMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcVoltageDivisor + * Attribute ClusterRevision */ -class ReadElectricalMeasurementDcVoltageDivisor : public ReadAttribute { +class ReadWakeOnLanClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementDcVoltageDivisor() - : ReadAttribute("dc-voltage-divisor") - { - } - - ~ReadElectricalMeasurementDcVoltageDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000201) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcVoltageDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcVoltageDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadWakeOnLanClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadWakeOnLanClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("WakeOnLAN ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcVoltageDivisor : public SubscribeAttribute { +class SubscribeAttributeWakeOnLanClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcVoltageDivisor() - : SubscribeAttribute("dc-voltage-divisor") - { - } + SubscribeAttributeWakeOnLanClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeElectricalMeasurementDcVoltageDivisor() {} + ~SubscribeAttributeWakeOnLanClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000201) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000503) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcVoltageDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcVoltageDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster Channel | 0x0504 | +|------------------------------------------------------------------------------| +| Commands: | | +| * ChangeChannel | 0x00 | +| * ChangeChannelByNumber | 0x02 | +| * SkipChannel | 0x03 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * ChannelList | 0x0000 | +| * Lineup | 0x0001 | +| * CurrentChannel | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute DcCurrentMultiplier + * Command ChangeChannel */ -class ReadElectricalMeasurementDcCurrentMultiplier : public ReadAttribute { +class ChannelChangeChannel : public ClusterCommand { public: - ReadElectricalMeasurementDcCurrentMultiplier() - : ReadAttribute("dc-current-multiplier") - { + ChannelChangeChannel() : ClusterCommand("change-channel") { + AddArgument("Match", &mRequest.match); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000504) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRChannelClusterChangeChannelParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.match = [[NSString alloc] initWithBytes:mRequest.match.data() + length:mRequest.match.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + changeChannelWithParams:params + completion:^(MTRChannelClusterChangeChannelResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementDcCurrentMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000202) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcCurrentMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcCurrentMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::Channel::Commands::ChangeChannel::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementDcCurrentMultiplier : public SubscribeAttribute { +/* + * Command ChangeChannelByNumber + */ +class ChannelChangeChannelByNumber : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementDcCurrentMultiplier() - : SubscribeAttribute("dc-current-multiplier") - { + ChannelChangeChannelByNumber() : ClusterCommand("change-channel-by-number") { + AddArgument("MajorNumber", 0, UINT16_MAX, &mRequest.majorNumber); + AddArgument("MinorNumber", 0, UINT16_MAX, &mRequest.minorNumber); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000504) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRChannelClusterChangeChannelByNumberParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.majorNumber = + [NSNumber numberWithUnsignedShort:mRequest.majorNumber]; + params.minorNumber = + [NSNumber numberWithUnsignedShort:mRequest.minorNumber]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster changeChannelByNumberWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementDcCurrentMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000202) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDcCurrentMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type mRequest; }; /* - * Attribute DcCurrentDivisor + * Command SkipChannel */ -class ReadElectricalMeasurementDcCurrentDivisor : public ReadAttribute { +class ChannelSkipChannel : public ClusterCommand { public: - ReadElectricalMeasurementDcCurrentDivisor() - : ReadAttribute("dc-current-divisor") - { + ChannelSkipChannel() : ClusterCommand("skip-channel") { + AddArgument("Count", 0, UINT16_MAX, &mRequest.count); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000504) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRChannelClusterSkipChannelParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.count = [NSNumber numberWithUnsignedShort:mRequest.count]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster skipChannelWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementDcCurrentDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000203) on endpoint %u", endpointId); +private: + chip::app::Clusters::Channel::Commands::SkipChannel::Type mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcCurrentDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcCurrentDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute ChannelList + */ +class ReadChannelChannelList : public ReadAttribute { +public: + ReadChannelChannelList() : ReadAttribute("channel-list") {} + + ~ReadChannelChannelList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeChannelListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.ChannelList response %@", [value description]); + if (error != nil) { + LogNSError("Channel ChannelList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcCurrentDivisor : public SubscribeAttribute { +class SubscribeAttributeChannelChannelList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcCurrentDivisor() - : SubscribeAttribute("dc-current-divisor") - { - } + SubscribeAttributeChannelChannelList() : SubscribeAttribute("channel-list") {} - ~SubscribeAttributeElectricalMeasurementDcCurrentDivisor() {} + ~SubscribeAttributeChannelChannelList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000203) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeChannelListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcCurrentDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcCurrentDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.ChannelList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcPowerMultiplier + * Attribute Lineup */ -class ReadElectricalMeasurementDcPowerMultiplier : public ReadAttribute { +class ReadChannelLineup : public ReadAttribute { public: - ReadElectricalMeasurementDcPowerMultiplier() - : ReadAttribute("dc-power-multiplier") - { - } - - ~ReadElectricalMeasurementDcPowerMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000204) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcPowerMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcPowerMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadChannelLineup() : ReadAttribute("lineup") {} + + ~ReadChannelLineup() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLineupWithCompletion:^( + MTRChannelClusterLineupInfo *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Channel.Lineup response %@", [value description]); + if (error != nil) { + LogNSError("Channel Lineup read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcPowerMultiplier : public SubscribeAttribute { +class SubscribeAttributeChannelLineup : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcPowerMultiplier() - : SubscribeAttribute("dc-power-multiplier") - { - } + SubscribeAttributeChannelLineup() : SubscribeAttribute("lineup") {} - ~SubscribeAttributeElectricalMeasurementDcPowerMultiplier() {} + ~SubscribeAttributeChannelLineup() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000204) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLineupWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcPowerMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(MTRChannelClusterLineupInfo *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Channel.Lineup response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute DcPowerDivisor + * Attribute CurrentChannel */ -class ReadElectricalMeasurementDcPowerDivisor : public ReadAttribute { +class ReadChannelCurrentChannel : public ReadAttribute { public: - ReadElectricalMeasurementDcPowerDivisor() - : ReadAttribute("dc-power-divisor") - { - } - - ~ReadElectricalMeasurementDcPowerDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000205) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeDcPowerDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement DcPowerDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadChannelCurrentChannel() : ReadAttribute("current-channel") {} + + ~ReadChannelCurrentChannel() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentChannelWithCompletion:^( + MTRChannelClusterChannelInfo *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Channel.CurrentChannel response %@", [value description]); + if (error != nil) { + LogNSError("Channel CurrentChannel read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementDcPowerDivisor : public SubscribeAttribute { +class SubscribeAttributeChannelCurrentChannel : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementDcPowerDivisor() - : SubscribeAttribute("dc-power-divisor") - { - } + SubscribeAttributeChannelCurrentChannel() + : SubscribeAttribute("current-channel") {} - ~SubscribeAttributeElectricalMeasurementDcPowerDivisor() {} + ~SubscribeAttributeChannelCurrentChannel() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000205) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentChannelWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeDcPowerDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.DcPowerDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(MTRChannelClusterChannelInfo *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Channel.CurrentChannel response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcFrequency + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementAcFrequency : public ReadAttribute { +class ReadChannelGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementAcFrequency() - : ReadAttribute("ac-frequency") - { - } - - ~ReadElectricalMeasurementAcFrequency() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000300) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequency response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcFrequency read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadChannelGeneratedCommandList() : ReadAttribute("generated-command-list") {} + + ~ReadChannelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Channel GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeChannelGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeChannelGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeChannelGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcFrequency : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadChannelAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAcFrequency() - : SubscribeAttribute("ac-frequency") - { - } + ReadChannelAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadChannelAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("Channel AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementAcFrequency() {} +class SubscribeAttributeChannelAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeChannelAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000300) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcFrequencyWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequency response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeChannelAcceptedCommandList() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -/* - * Attribute AcFrequencyMin - */ -class ReadElectricalMeasurementAcFrequencyMin : public ReadAttribute { -public: - ReadElectricalMeasurementAcFrequencyMin() - : ReadAttribute("ac-frequency-min") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - ~ReadElectricalMeasurementAcFrequencyMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000301) on endpoint %u", endpointId); + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcFrequencyMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcFrequencyMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadChannelAttributeList : public ReadAttribute { +public: + ReadChannelAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadChannelAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("Channel AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcFrequencyMin : public SubscribeAttribute { +class SubscribeAttributeChannelAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcFrequencyMin() - : SubscribeAttribute("ac-frequency-min") - { - } + SubscribeAttributeChannelAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementAcFrequencyMin() {} + ~SubscribeAttributeChannelAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000301) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcFrequencyMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcFrequencyMax + * Attribute FeatureMap */ -class ReadElectricalMeasurementAcFrequencyMax : public ReadAttribute { +class ReadChannelFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementAcFrequencyMax() - : ReadAttribute("ac-frequency-max") - { - } - - ~ReadElectricalMeasurementAcFrequencyMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000302) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcFrequencyMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcFrequencyMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadChannelFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadChannelFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"Channel.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("Channel FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcFrequencyMax : public SubscribeAttribute { +class SubscribeAttributeChannelFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcFrequencyMax() - : SubscribeAttribute("ac-frequency-max") - { - } + SubscribeAttributeChannelFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementAcFrequencyMax() {} + ~SubscribeAttributeChannelFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000302) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcFrequencyMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute NeutralCurrent + * Attribute ClusterRevision */ -class ReadElectricalMeasurementNeutralCurrent : public ReadAttribute { +class ReadChannelClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementNeutralCurrent() - : ReadAttribute("neutral-current") - { - } - - ~ReadElectricalMeasurementNeutralCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000303) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNeutralCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.NeutralCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement NeutralCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadChannelClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadChannelClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("Channel ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementNeutralCurrent : public SubscribeAttribute { +class SubscribeAttributeChannelClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementNeutralCurrent() - : SubscribeAttribute("neutral-current") - { - } + SubscribeAttributeChannelClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeElectricalMeasurementNeutralCurrent() {} + ~SubscribeAttributeChannelClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000303) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000504) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterChannel alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNeutralCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.NeutralCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"Channel.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster TargetNavigator | 0x0505 | +|------------------------------------------------------------------------------| +| Commands: | | +| * NavigateTarget | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * TargetList | 0x0000 | +| * CurrentTarget | 0x0001 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute TotalActivePower + * Command NavigateTarget */ -class ReadElectricalMeasurementTotalActivePower : public ReadAttribute { +class TargetNavigatorNavigateTarget : public ClusterCommand { public: - ReadElectricalMeasurementTotalActivePower() - : ReadAttribute("total-active-power") - { + TargetNavigatorNavigateTarget() : ClusterCommand("navigate-target") { + AddArgument("Target", 0, UINT8_MAX, &mRequest.target); + AddArgument("Data", &mRequest.data); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000505) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRTargetNavigatorClusterNavigateTargetParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.target = [NSNumber numberWithUnsignedChar:mRequest.target]; + if (mRequest.data.HasValue()) { + params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() + length:mRequest.data.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + params.data = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + navigateTargetWithParams:params + completion:^( + MTRTargetNavigatorClusterNavigateTargetResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementTotalActivePower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000304) on endpoint %u", endpointId); +private: + chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTotalActivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalActivePower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement TotalActivePower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute TargetList + */ +class ReadTargetNavigatorTargetList : public ReadAttribute { +public: + ReadTargetNavigatorTargetList() : ReadAttribute("target-list") {} + + ~ReadTargetNavigatorTargetList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTargetListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TargetNavigator.TargetList response %@", [value description]); + if (error != nil) { + LogNSError("TargetNavigator TargetList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementTotalActivePower : public SubscribeAttribute { +class SubscribeAttributeTargetNavigatorTargetList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementTotalActivePower() - : SubscribeAttribute("total-active-power") - { - } + SubscribeAttributeTargetNavigatorTargetList() + : SubscribeAttribute("target-list") {} - ~SubscribeAttributeElectricalMeasurementTotalActivePower() {} + ~SubscribeAttributeTargetNavigatorTargetList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000304) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTargetListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTotalActivePowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalActivePower response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.TargetList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TotalReactivePower + * Attribute CurrentTarget */ -class ReadElectricalMeasurementTotalReactivePower : public ReadAttribute { +class ReadTargetNavigatorCurrentTarget : public ReadAttribute { public: - ReadElectricalMeasurementTotalReactivePower() - : ReadAttribute("total-reactive-power") - { - } + ReadTargetNavigatorCurrentTarget() : ReadAttribute("current-target") {} + + ~ReadTargetNavigatorCurrentTarget() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentTargetWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); + if (error != nil) { + LogNSError("TargetNavigator CurrentTarget read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTargetNavigatorCurrentTarget + : public SubscribeAttribute { +public: + SubscribeAttributeTargetNavigatorCurrentTarget() + : SubscribeAttribute("current-target") {} + + ~SubscribeAttributeTargetNavigatorCurrentTarget() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentTargetWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.CurrentTarget response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute GeneratedCommandList + */ +class ReadTargetNavigatorGeneratedCommandList : public ReadAttribute { +public: + ReadTargetNavigatorGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadTargetNavigatorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TargetNavigator GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTargetNavigatorGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTargetNavigatorGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeTargetNavigatorGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementTotalReactivePower() {} +/* + * Attribute AcceptedCommandList + */ +class ReadTargetNavigatorAcceptedCommandList : public ReadAttribute { +public: + ReadTargetNavigatorAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadTargetNavigatorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("TargetNavigator AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTargetNavigatorAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeTargetNavigatorAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeTargetNavigatorAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000305) on endpoint %u", endpointId); +/* + * Attribute AttributeList + */ +class ReadTargetNavigatorAttributeList : public ReadAttribute { +public: + ReadTargetNavigatorAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadTargetNavigatorAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("TargetNavigator AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTargetNavigatorAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeTargetNavigatorAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeTargetNavigatorAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTotalReactivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalReactivePower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement TotalReactivePower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute FeatureMap + */ +class ReadTargetNavigatorFeatureMap : public ReadAttribute { +public: + ReadTargetNavigatorFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadTargetNavigatorFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("TargetNavigator FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementTotalReactivePower : public SubscribeAttribute { +class SubscribeAttributeTargetNavigatorFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementTotalReactivePower() - : SubscribeAttribute("total-reactive-power") - { - } + SubscribeAttributeTargetNavigatorFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementTotalReactivePower() {} + ~SubscribeAttributeTargetNavigatorFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000305) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTotalReactivePowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalReactivePower response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute TotalApparentPower + * Attribute ClusterRevision */ -class ReadElectricalMeasurementTotalApparentPower : public ReadAttribute { +class ReadTargetNavigatorClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementTotalApparentPower() - : ReadAttribute("total-apparent-power") - { - } + ReadTargetNavigatorClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadTargetNavigatorClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("TargetNavigator ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeTargetNavigatorClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeTargetNavigatorClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeTargetNavigatorClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000505) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"TargetNavigator.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementTotalApparentPower() {} +/*----------------------------------------------------------------------------*\ +| Cluster MediaPlayback | 0x0506 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Play | 0x00 | +| * Pause | 0x01 | +| * StopPlayback | 0x02 | +| * StartOver | 0x03 | +| * Previous | 0x04 | +| * Next | 0x05 | +| * Rewind | 0x06 | +| * FastForward | 0x07 | +| * SkipForward | 0x08 | +| * SkipBackward | 0x09 | +| * Seek | 0x0B | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CurrentState | 0x0000 | +| * StartTime | 0x0001 | +| * Duration | 0x0002 | +| * SampledPosition | 0x0003 | +| * PlaybackSpeed | 0x0004 | +| * SeekRangeEnd | 0x0005 | +| * SeekRangeStart | 0x0006 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000306) on endpoint %u", endpointId); +/* + * Command Play + */ +class MediaPlaybackPlay : public ClusterCommand { +public: + MediaPlaybackPlay() : ClusterCommand("play") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterPlayParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster playWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTotalApparentPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalApparentPower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement TotalApparentPower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributeElectricalMeasurementTotalApparentPower : public SubscribeAttribute { +/* + * Command Pause + */ +class MediaPlaybackPause : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementTotalApparentPower() - : SubscribeAttribute("total-apparent-power") - { - } - - ~SubscribeAttributeElectricalMeasurementTotalApparentPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000306) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeTotalApparentPowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.TotalApparentPower response %@", [value description]); - SetCommandExitStatus(error); - }]; + MediaPlaybackPause() : ClusterCommand("pause") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterPauseParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster pauseWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute Measured1stHarmonicCurrent + * Command StopPlayback */ -class ReadElectricalMeasurementMeasured1stHarmonicCurrent : public ReadAttribute { +class MediaPlaybackStopPlayback : public ClusterCommand { public: - ReadElectricalMeasurementMeasured1stHarmonicCurrent() - : ReadAttribute("measured1st-harmonic-current") - { + MediaPlaybackStopPlayback() : ClusterCommand("stop-playback") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaPlaybackClusterStopPlaybackParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + stopPlaybackWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementMeasured1stHarmonicCurrent() {} +private: +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000307) on endpoint %u", endpointId); +/* + * Command StartOver + */ +class MediaPlaybackStartOver : public ClusterCommand { +public: + MediaPlaybackStartOver() : ClusterCommand("start-over") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterStartOverParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + startOverWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured1stHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured1stHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured1stHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent : public SubscribeAttribute { +/* + * Command Previous + */ +class MediaPlaybackPrevious : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent() - : SubscribeAttribute("measured1st-harmonic-current") - { + MediaPlaybackPrevious() : ClusterCommand("previous") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterPreviousParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + previousWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent() {} +private: +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000307) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasured1stHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured1stHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Command Next + */ +class MediaPlaybackNext : public ClusterCommand { +public: + MediaPlaybackNext() : ClusterCommand("next") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterNextParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster nextWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute Measured3rdHarmonicCurrent + * Command Rewind */ -class ReadElectricalMeasurementMeasured3rdHarmonicCurrent : public ReadAttribute { +class MediaPlaybackRewind : public ClusterCommand { public: - ReadElectricalMeasurementMeasured3rdHarmonicCurrent() - : ReadAttribute("measured3rd-harmonic-current") - { + MediaPlaybackRewind() : ClusterCommand("rewind") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterRewindParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster rewindWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementMeasured3rdHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000308) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured3rdHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured3rdHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured3rdHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent : public SubscribeAttribute { +/* + * Command FastForward + */ +class MediaPlaybackFastForward : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent() - : SubscribeAttribute("measured3rd-harmonic-current") - { + MediaPlaybackFastForward() : ClusterCommand("fast-forward") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaPlaybackClusterFastForwardParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + fastForwardWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000308) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasured3rdHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured3rdHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute Measured5thHarmonicCurrent + * Command SkipForward */ -class ReadElectricalMeasurementMeasured5thHarmonicCurrent : public ReadAttribute { +class MediaPlaybackSkipForward : public ClusterCommand { public: - ReadElectricalMeasurementMeasured5thHarmonicCurrent() - : ReadAttribute("measured5th-harmonic-current") - { + MediaPlaybackSkipForward() : ClusterCommand("skip-forward") { + AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, + &mRequest.deltaPositionMilliseconds); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaPlaybackClusterSkipForwardParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.deltaPositionMilliseconds = [NSNumber + numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + skipForwardWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementMeasured5thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000309) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured5thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured5thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured5thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent : public SubscribeAttribute { +/* + * Command SkipBackward + */ +class MediaPlaybackSkipBackward : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent() - : SubscribeAttribute("measured5th-harmonic-current") - { + MediaPlaybackSkipBackward() : ClusterCommand("skip-backward") { + AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, + &mRequest.deltaPositionMilliseconds); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x00000009) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaPlaybackClusterSkipBackwardParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.deltaPositionMilliseconds = [NSNumber + numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + skipBackwardWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000309) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasured5thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured5thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type mRequest; }; /* - * Attribute Measured7thHarmonicCurrent + * Command Seek */ -class ReadElectricalMeasurementMeasured7thHarmonicCurrent : public ReadAttribute { +class MediaPlaybackSeek : public ClusterCommand { public: - ReadElectricalMeasurementMeasured7thHarmonicCurrent() - : ReadAttribute("measured7th-harmonic-current") - { - } + MediaPlaybackSeek() : ClusterCommand("seek") { + AddArgument("Position", 0, UINT64_MAX, &mRequest.position); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000506) command (0x0000000B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaPlaybackClusterSeekParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.position = [NSNumber numberWithUnsignedLongLong:mRequest.position]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster seekWithParams:params + completion:^(MTRMediaPlaybackClusterPlaybackResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementMeasured7thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030A) on endpoint %u", endpointId); +private: + chip::app::Clusters::MediaPlayback::Commands::Seek::Type mRequest; +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured7thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured7thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured7thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute CurrentState + */ +class ReadMediaPlaybackCurrentState : public ReadAttribute { +public: + ReadMediaPlaybackCurrentState() : ReadAttribute("current-state") {} + + ~ReadMediaPlaybackCurrentState() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentStateWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.CurrentState response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback CurrentState read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackCurrentState : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent() - : SubscribeAttribute("measured7th-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackCurrentState() + : SubscribeAttribute("current-state") {} - ~SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackCurrentState() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentStateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasured7thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured7thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.CurrentState response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Measured9thHarmonicCurrent + * Attribute StartTime */ -class ReadElectricalMeasurementMeasured9thHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackStartTime : public ReadAttribute { public: - ReadElectricalMeasurementMeasured9thHarmonicCurrent() - : ReadAttribute("measured9th-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasured9thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured9thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured9thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured9thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaPlaybackStartTime() : ReadAttribute("start-time") {} + + ~ReadMediaPlaybackStartTime() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStartTimeWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaPlayback.StartTime response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback StartTime read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackStartTime : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent() - : SubscribeAttribute("measured9th-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackStartTime() + : SubscribeAttribute("start-time") {} - ~SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackStartTime() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartTimeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasured9thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured9thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.StartTime response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute Measured11thHarmonicCurrent + * Attribute Duration */ -class ReadElectricalMeasurementMeasured11thHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackDuration : public ReadAttribute { public: - ReadElectricalMeasurementMeasured11thHarmonicCurrent() - : ReadAttribute("measured11th-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasured11thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeMeasured11thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured11thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement Measured11thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaPlaybackDuration() : ReadAttribute("duration") {} + + ~ReadMediaPlaybackDuration() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDurationWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaPlayback.Duration response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback Duration read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackDuration : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent() - : SubscribeAttribute("measured11th-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackDuration() : SubscribeAttribute("duration") {} - ~SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackDuration() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDurationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasured11thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.Measured11thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.Duration response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasuredPhase1stHarmonicCurrent + * Attribute SampledPosition */ -class ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackSampledPosition : public ReadAttribute { public: - ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent() - : ReadAttribute("measured-phase1st-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030D) on endpoint %u", endpointId); + ReadMediaPlaybackSampledPosition() : ReadAttribute("sampled-position") {} + + ~ReadMediaPlaybackSampledPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSampledPositionWithCompletion:^( + MTRMediaPlaybackClusterPlaybackPosition *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback SampledPosition read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaPlaybackSampledPosition + : public SubscribeAttribute { +public: + SubscribeAttributeMediaPlaybackSampledPosition() + : SubscribeAttribute("sampled-position") {} + + ~SubscribeAttributeMediaPlaybackSampledPosition() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSampledPositionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^( + MTRMediaPlaybackClusterPlaybackPosition *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaPlayback.SampledPosition response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase1stHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase1stHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase1stHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute PlaybackSpeed + */ +class ReadMediaPlaybackPlaybackSpeed : public ReadAttribute { +public: + ReadMediaPlaybackPlaybackSpeed() : ReadAttribute("playback-speed") {} + + ~ReadMediaPlaybackPlaybackSpeed() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePlaybackSpeedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback PlaybackSpeed read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackPlaybackSpeed : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent() - : SubscribeAttribute("measured-phase1st-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackPlaybackSpeed() + : SubscribeAttribute("playback-speed") {} - ~SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackPlaybackSpeed() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePlaybackSpeedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasuredPhase1stHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase1stHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.PlaybackSpeed response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasuredPhase3rdHarmonicCurrent + * Attribute SeekRangeEnd */ -class ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackSeekRangeEnd : public ReadAttribute { public: - ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() - : ReadAttribute("measured-phase3rd-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase3rdHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase3rdHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase3rdHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaPlaybackSeekRangeEnd() : ReadAttribute("seek-range-end") {} + + ~ReadMediaPlaybackSeekRangeEnd() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSeekRangeEndWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback SeekRangeEnd read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackSeekRangeEnd : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() - : SubscribeAttribute("measured-phase3rd-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackSeekRangeEnd() + : SubscribeAttribute("seek-range-end") {} - ~SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackSeekRangeEnd() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSeekRangeEndWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasuredPhase3rdHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase3rdHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasuredPhase5thHarmonicCurrent + * Attribute SeekRangeStart */ -class ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackSeekRangeStart : public ReadAttribute { public: - ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent() - : ReadAttribute("measured-phase5th-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000030F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase5thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase5thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase5thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaPlaybackSeekRangeStart() : ReadAttribute("seek-range-start") {} + + ~ReadMediaPlaybackSeekRangeStart() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSeekRangeStartWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback SeekRangeStart read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaPlaybackSeekRangeStart + : public SubscribeAttribute { +public: + SubscribeAttributeMediaPlaybackSeekRangeStart() + : SubscribeAttribute("seek-range-start") {} + + ~SubscribeAttributeMediaPlaybackSeekRangeStart() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSeekRangeStartWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.SeekRangeStart response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadMediaPlaybackGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent() - : SubscribeAttribute("measured-phase5th-harmonic-current") - { - } - - ~SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000030F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredPhase5thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase5thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadMediaPlaybackGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadMediaPlaybackGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("MediaPlayback GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaPlaybackGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeMediaPlaybackGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeMediaPlaybackGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasuredPhase7thHarmonicCurrent + * Attribute AcceptedCommandList */ -class ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackAcceptedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent() - : ReadAttribute("measured-phase7th-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000310) on endpoint %u", endpointId); + ReadMediaPlaybackAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadMediaPlaybackAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("MediaPlayback AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaPlaybackAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeMediaPlaybackAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeMediaPlaybackAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase7thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase7thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase7thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadMediaPlaybackAttributeList : public ReadAttribute { +public: + ReadMediaPlaybackAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadMediaPlaybackAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent() - : SubscribeAttribute("measured-phase7th-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000310) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasuredPhase7thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase7thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute MeasuredPhase9thHarmonicCurrent + * Attribute FeatureMap */ -class ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent : public ReadAttribute { +class ReadMediaPlaybackFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent() - : ReadAttribute("measured-phase9th-harmonic-current") - { - } - - ~ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000311) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase9thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase9thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase9thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaPlaybackFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadMediaPlaybackFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent : public SubscribeAttribute { +class SubscribeAttributeMediaPlaybackFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent() - : SubscribeAttribute("measured-phase9th-harmonic-current") - { - } + SubscribeAttributeMediaPlaybackFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent() {} + ~SubscribeAttributeMediaPlaybackFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000311) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeMeasuredPhase9thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase9thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadMediaPlaybackClusterRevision : public ReadAttribute { +public: + ReadMediaPlaybackClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadMediaPlaybackClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("MediaPlayback ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaPlaybackClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeMediaPlaybackClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeMediaPlaybackClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000506) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaPlayback.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster MediaInput | 0x0507 | +|------------------------------------------------------------------------------| +| Commands: | | +| * SelectInput | 0x00 | +| * ShowInputStatus | 0x01 | +| * HideInputStatus | 0x02 | +| * RenameInput | 0x03 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * InputList | 0x0000 | +| * CurrentInput | 0x0001 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute MeasuredPhase11thHarmonicCurrent + * Command SelectInput */ -class ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent : public ReadAttribute { +class MediaInputSelectInput : public ClusterCommand { public: - ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent() - : ReadAttribute("measured-phase11th-harmonic-current") - { + MediaInputSelectInput() : ClusterCommand("select-input") { + AddArgument("Index", 0, UINT8_MAX, &mRequest.index); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000507) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaInputClusterSelectInputParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster selectInputWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000312) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeMeasuredPhase11thHarmonicCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase11thHarmonicCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement MeasuredPhase11thHarmonicCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::MediaInput::Commands::SelectInput::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent : public SubscribeAttribute { +/* + * Command ShowInputStatus + */ +class MediaInputShowInputStatus : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent() - : SubscribeAttribute("measured-phase11th-harmonic-current") - { + MediaInputShowInputStatus() : ClusterCommand("show-input-status") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000507) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaInputClusterShowInputStatusParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster showInputStatusWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000312) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeMeasuredPhase11thHarmonicCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.MeasuredPhase11thHarmonicCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute AcFrequencyMultiplier + * Command HideInputStatus */ -class ReadElectricalMeasurementAcFrequencyMultiplier : public ReadAttribute { +class MediaInputHideInputStatus : public ClusterCommand { public: - ReadElectricalMeasurementAcFrequencyMultiplier() - : ReadAttribute("ac-frequency-multiplier") - { + MediaInputHideInputStatus() : ClusterCommand("hide-input-status") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000507) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRMediaInputClusterHideInputStatusParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster hideInputStatusWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementAcFrequencyMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000400) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcFrequencyMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcFrequencyMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: }; -class SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier : public SubscribeAttribute { +/* + * Command RenameInput + */ +class MediaInputRenameInput : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier() - : SubscribeAttribute("ac-frequency-multiplier") - { + MediaInputRenameInput() : ClusterCommand("rename-input") { + AddArgument("Index", 0, UINT8_MAX, &mRequest.index); + AddArgument("Name", &mRequest.name); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000507) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRMediaInputClusterRenameInputParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; + params.name = [[NSString alloc] initWithBytes:mRequest.name.data() + length:mRequest.name.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster renameInputWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000400) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcFrequencyMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::MediaInput::Commands::RenameInput::Type mRequest; }; /* - * Attribute AcFrequencyDivisor + * Attribute InputList */ -class ReadElectricalMeasurementAcFrequencyDivisor : public ReadAttribute { +class ReadMediaInputInputList : public ReadAttribute { public: - ReadElectricalMeasurementAcFrequencyDivisor() - : ReadAttribute("ac-frequency-divisor") - { - } - - ~ReadElectricalMeasurementAcFrequencyDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000401) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcFrequencyDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcFrequencyDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputInputList() : ReadAttribute("input-list") {} + + ~ReadMediaInputInputList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInputListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaInput.InputList response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput InputList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcFrequencyDivisor : public SubscribeAttribute { +class SubscribeAttributeMediaInputInputList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcFrequencyDivisor() - : SubscribeAttribute("ac-frequency-divisor") - { - } + SubscribeAttributeMediaInputInputList() : SubscribeAttribute("input-list") {} - ~SubscribeAttributeElectricalMeasurementAcFrequencyDivisor() {} + ~SubscribeAttributeMediaInputInputList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000401) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInputListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcFrequencyDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcFrequencyDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.InputList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PowerMultiplier + * Attribute CurrentInput */ -class ReadElectricalMeasurementPowerMultiplier : public ReadAttribute { +class ReadMediaInputCurrentInput : public ReadAttribute { public: - ReadElectricalMeasurementPowerMultiplier() - : ReadAttribute("power-multiplier") - { - } - - ~ReadElectricalMeasurementPowerMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000402) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PowerMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputCurrentInput() : ReadAttribute("current-input") {} + + ~ReadMediaInputCurrentInput() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentInputWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.CurrentInput response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput CurrentInput read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPowerMultiplier : public SubscribeAttribute { +class SubscribeAttributeMediaInputCurrentInput : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementPowerMultiplier() - : SubscribeAttribute("power-multiplier") - { - } + SubscribeAttributeMediaInputCurrentInput() + : SubscribeAttribute("current-input") {} - ~SubscribeAttributeElectricalMeasurementPowerMultiplier() {} + ~SubscribeAttributeMediaInputCurrentInput() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000402) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentInputWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePowerMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.CurrentInput response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PowerDivisor + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementPowerDivisor : public ReadAttribute { +class ReadMediaInputGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementPowerDivisor() - : ReadAttribute("power-divisor") - { - } - - ~ReadElectricalMeasurementPowerDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000403) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PowerDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadMediaInputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("MediaInput GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaInputGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeMediaInputGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeMediaInputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPowerDivisor : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadMediaInputAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementPowerDivisor() - : SubscribeAttribute("power-divisor") - { - } - - ~SubscribeAttributeElectricalMeasurementPowerDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000403) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePowerDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadMediaInputAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadMediaInputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMediaInputAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeMediaInputAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeMediaInputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute HarmonicCurrentMultiplier + * Attribute AttributeList */ -class ReadElectricalMeasurementHarmonicCurrentMultiplier : public ReadAttribute { +class ReadMediaInputAttributeList : public ReadAttribute { public: - ReadElectricalMeasurementHarmonicCurrentMultiplier() - : ReadAttribute("harmonic-current-multiplier") - { - } - - ~ReadElectricalMeasurementHarmonicCurrentMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000404) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeHarmonicCurrentMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.HarmonicCurrentMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement HarmonicCurrentMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadMediaInputAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier : public SubscribeAttribute { +class SubscribeAttributeMediaInputAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier() - : SubscribeAttribute("harmonic-current-multiplier") - { - } + SubscribeAttributeMediaInputAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier() {} + ~SubscribeAttributeMediaInputAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000404) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeHarmonicCurrentMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.HarmonicCurrentMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute PhaseHarmonicCurrentMultiplier + * Attribute FeatureMap */ -class ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier : public ReadAttribute { +class ReadMediaInputFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier() - : ReadAttribute("phase-harmonic-current-multiplier") - { - } - - ~ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000405) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributePhaseHarmonicCurrentMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PhaseHarmonicCurrentMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PhaseHarmonicCurrentMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadMediaInputFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"MediaInput.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier : public SubscribeAttribute { +class SubscribeAttributeMediaInputFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier() - : SubscribeAttribute("phase-harmonic-current-multiplier") - { - } + SubscribeAttributeMediaInputFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier() {} + ~SubscribeAttributeMediaInputFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000405) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePhaseHarmonicCurrentMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PhaseHarmonicCurrentMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute InstantaneousVoltage + * Attribute ClusterRevision */ -class ReadElectricalMeasurementInstantaneousVoltage : public ReadAttribute { +class ReadMediaInputClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementInstantaneousVoltage() - : ReadAttribute("instantaneous-voltage") - { - } - - ~ReadElectricalMeasurementInstantaneousVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000500) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstantaneousVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement InstantaneousVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadMediaInputClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadMediaInputClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("MediaInput ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementInstantaneousVoltage : public SubscribeAttribute { +class SubscribeAttributeMediaInputClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementInstantaneousVoltage() - : SubscribeAttribute("instantaneous-voltage") - { - } + SubscribeAttributeMediaInputClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeElectricalMeasurementInstantaneousVoltage() {} + ~SubscribeAttributeMediaInputClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000500) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000507) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterMediaInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInstantaneousVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"MediaInput.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster LowPower | 0x0508 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Sleep | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute InstantaneousLineCurrent + * Command Sleep */ -class ReadElectricalMeasurementInstantaneousLineCurrent : public ReadAttribute { -public: - ReadElectricalMeasurementInstantaneousLineCurrent() - : ReadAttribute("instantaneous-line-current") - { - } - - ~ReadElectricalMeasurementInstantaneousLineCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000501) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstantaneousLineCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousLineCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement InstantaneousLineCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent : public SubscribeAttribute { +class LowPowerSleep : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent() - : SubscribeAttribute("instantaneous-line-current") - { - } + LowPowerSleep() : ClusterCommand("sleep") { ClusterCommand::AddArguments(); } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000508) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRLowPowerClusterSleepParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster sleepWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000501) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstantaneousLineCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousLineCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute InstantaneousActiveCurrent + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementInstantaneousActiveCurrent : public ReadAttribute { +class ReadLowPowerGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementInstantaneousActiveCurrent() - : ReadAttribute("instantaneous-active-current") - { - } - - ~ReadElectricalMeasurementInstantaneousActiveCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000502) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstantaneousActiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousActiveCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement InstantaneousActiveCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLowPowerGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadLowPowerGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("LowPower GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLowPowerGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLowPowerGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeLowPowerGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadLowPowerAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent() - : SubscribeAttribute("instantaneous-active-current") - { - } - - ~SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000502) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInstantaneousActiveCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousActiveCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadLowPowerAcceptedCommandList() : ReadAttribute("accepted-command-list") {} + + ~ReadLowPowerAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("LowPower AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeLowPowerAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeLowPowerAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeLowPowerAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute InstantaneousReactiveCurrent + * Attribute AttributeList */ -class ReadElectricalMeasurementInstantaneousReactiveCurrent : public ReadAttribute { +class ReadLowPowerAttributeList : public ReadAttribute { public: - ReadElectricalMeasurementInstantaneousReactiveCurrent() - : ReadAttribute("instantaneous-reactive-current") - { - } - - ~ReadElectricalMeasurementInstantaneousReactiveCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000503) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstantaneousReactiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousReactiveCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement InstantaneousReactiveCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLowPowerAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadLowPowerAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("LowPower AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent : public SubscribeAttribute { +class SubscribeAttributeLowPowerAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent() - : SubscribeAttribute("instantaneous-reactive-current") - { - } + SubscribeAttributeLowPowerAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent() {} + ~SubscribeAttributeLowPowerAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000503) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInstantaneousReactiveCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousReactiveCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute InstantaneousPower + * Attribute FeatureMap */ -class ReadElectricalMeasurementInstantaneousPower : public ReadAttribute { +class ReadLowPowerFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementInstantaneousPower() - : ReadAttribute("instantaneous-power") - { - } - - ~ReadElectricalMeasurementInstantaneousPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000504) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInstantaneousPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousPower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement InstantaneousPower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLowPowerFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadLowPowerFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"LowPower.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("LowPower FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementInstantaneousPower : public SubscribeAttribute { +class SubscribeAttributeLowPowerFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementInstantaneousPower() - : SubscribeAttribute("instantaneous-power") - { - } + SubscribeAttributeLowPowerFeatureMap() : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementInstantaneousPower() {} + ~SubscribeAttributeLowPowerFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000504) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInstantaneousPowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.InstantaneousPower response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltage + * Attribute ClusterRevision */ -class ReadElectricalMeasurementRmsVoltage : public ReadAttribute { +class ReadLowPowerClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltage() - : ReadAttribute("rms-voltage") - { - } - - ~ReadElectricalMeasurementRmsVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000505) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadLowPowerClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadLowPowerClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("LowPower ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltage : public SubscribeAttribute { +class SubscribeAttributeLowPowerClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltage() - : SubscribeAttribute("rms-voltage") - { - } + SubscribeAttributeLowPowerClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltage() {} + ~SubscribeAttributeLowPowerClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000505) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000508) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterLowPower alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"LowPower.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster KeypadInput | 0x0509 | +|------------------------------------------------------------------------------| +| Commands: | | +| * SendKey | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute RmsVoltageMin + * Command SendKey */ -class ReadElectricalMeasurementRmsVoltageMin : public ReadAttribute { +class KeypadInputSendKey : public ClusterCommand { public: - ReadElectricalMeasurementRmsVoltageMin() - : ReadAttribute("rms-voltage-min") - { + KeypadInputSendKey() : ClusterCommand("send-key") { + AddArgument("KeyCode", 0, UINT8_MAX, &mRequest.keyCode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000509) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRKeypadInputClusterSendKeyParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.keyCode = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.keyCode)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster sendKeyWithParams:params + completion:^(MTRKeypadInputClusterSendKeyResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementRmsVoltageMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000506) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::KeypadInput::Commands::SendKey::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMin : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadKeypadInputGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMin() - : SubscribeAttribute("rms-voltage-min") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000506) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMin response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadKeypadInputGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadKeypadInputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("KeypadInput GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeKeypadInputGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeKeypadInputGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeKeypadInputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageMax + * Attribute AcceptedCommandList */ -class ReadElectricalMeasurementRmsVoltageMax : public ReadAttribute { +class ReadKeypadInputAcceptedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageMax() - : ReadAttribute("rms-voltage-max") - { - } - - ~ReadElectricalMeasurementRmsVoltageMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000507) on endpoint %u", endpointId); + ReadKeypadInputAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadKeypadInputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("KeypadInput AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeKeypadInputAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeKeypadInputAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeKeypadInputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AttributeList + */ +class ReadKeypadInputAttributeList : public ReadAttribute { +public: + ReadKeypadInputAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadKeypadInputAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("KeypadInput AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMax : public SubscribeAttribute { +class SubscribeAttributeKeypadInputAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMax() - : SubscribeAttribute("rms-voltage-max") - { - } + SubscribeAttributeKeypadInputAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltageMax() {} + ~SubscribeAttributeKeypadInputAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000507) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrent + * Attribute FeatureMap */ -class ReadElectricalMeasurementRmsCurrent : public ReadAttribute { +class ReadKeypadInputFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrent() - : ReadAttribute("rms-current") - { - } - - ~ReadElectricalMeasurementRmsCurrent() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000508) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrent response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrent read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadKeypadInputFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadKeypadInputFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"KeypadInput.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("KeypadInput FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrent : public SubscribeAttribute { +class SubscribeAttributeKeypadInputFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrent() - : SubscribeAttribute("rms-current") - { - } + SubscribeAttributeKeypadInputFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementRmsCurrent() {} + ~SubscribeAttributeKeypadInputFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000508) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsCurrentWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrent response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentMin + * Attribute ClusterRevision */ -class ReadElectricalMeasurementRmsCurrentMin : public ReadAttribute { +class ReadKeypadInputClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentMin() - : ReadAttribute("rms-current-min") - { - } - - ~ReadElectricalMeasurementRmsCurrentMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000509) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadKeypadInputClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadKeypadInputClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("KeypadInput ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentMin : public SubscribeAttribute { +class SubscribeAttributeKeypadInputClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentMin() - : SubscribeAttribute("rms-current-min") - { - } + SubscribeAttributeKeypadInputClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeElectricalMeasurementRmsCurrentMin() {} + ~SubscribeAttributeKeypadInputClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000509) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000509) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterKeypadInput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsCurrentMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"KeypadInput.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster ContentLauncher | 0x050A | +|------------------------------------------------------------------------------| +| Commands: | | +| * LaunchContent | 0x00 | +| * LaunchURL | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * AcceptHeader | 0x0000 | +| * SupportedStreamingProtocols | 0x0001 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute RmsCurrentMax + * Command LaunchContent */ -class ReadElectricalMeasurementRmsCurrentMax : public ReadAttribute { +class ContentLauncherLaunchContent : public ClusterCommand { public: - ReadElectricalMeasurementRmsCurrentMax() - : ReadAttribute("rms-current-max") - { - } - - ~ReadElectricalMeasurementRmsCurrentMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + ContentLauncherLaunchContent() + : ClusterCommand("launch-content"), mComplex_Search(&mRequest.search) { + AddArgument("Search", &mComplex_Search); + AddArgument("AutoPlay", 0, 1, &mRequest.autoPlay); + AddArgument("Data", &mRequest.data); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050A) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.search = [MTRContentLauncherClusterContentSearch new]; + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.search.parameterList) { + MTRContentLauncherClusterParameter *newElement_1; + newElement_1 = [MTRContentLauncherClusterParameter new]; + newElement_1.type = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.type)]; + newElement_1.value = + [[NSString alloc] initWithBytes:entry_1.value.data() + length:entry_1.value.size() + encoding:NSUTF8StringEncoding]; + if (entry_1.externalIDList.HasValue()) { + { // Scope for our temporary variables + auto *array_4 = [NSMutableArray new]; + for (auto &entry_4 : entry_1.externalIDList.Value()) { + MTRContentLauncherClusterAdditionalInfo *newElement_4; + newElement_4 = [MTRContentLauncherClusterAdditionalInfo new]; + newElement_4.name = + [[NSString alloc] initWithBytes:entry_4.name.data() + length:entry_4.name.size() + encoding:NSUTF8StringEncoding]; + newElement_4.value = + [[NSString alloc] initWithBytes:entry_4.value.data() + length:entry_4.value.size() + encoding:NSUTF8StringEncoding]; + [array_4 addObject:newElement_4]; + } + newElement_1.externalIDList = array_4; + } + } else { + newElement_1.externalIDList = nil; + } + [array_1 addObject:newElement_1]; + } + params.search.parameterList = array_1; } -}; - -class SubscribeAttributeElectricalMeasurementRmsCurrentMax : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementRmsCurrentMax() - : SubscribeAttribute("rms-current-max") - { + params.autoPlay = [NSNumber numberWithBool:mRequest.autoPlay]; + if (mRequest.data.HasValue()) { + params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() + length:mRequest.data.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + params.data = nil; } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMax response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster launchContentWithParams:params + completion:^( + MTRContentLauncherClusterLaunchResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type> + mComplex_Search; }; /* - * Attribute ActivePower + * Command LaunchURL */ -class ReadElectricalMeasurementActivePower : public ReadAttribute { +class ContentLauncherLaunchURL : public ClusterCommand { public: - ReadElectricalMeasurementActivePower() - : ReadAttribute("active-power") - { - } - - ~ReadElectricalMeasurementActivePower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050B) on endpoint %u", endpointId); + ContentLauncherLaunchURL() + : ClusterCommand("launch-url"), + mComplex_BrandingInformation(&mRequest.brandingInformation) { + AddArgument("ContentURL", &mRequest.contentURL); + AddArgument("DisplayString", &mRequest.displayString); + AddArgument("BrandingInformation", &mComplex_BrandingInformation); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050A) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.contentURL = + [[NSString alloc] initWithBytes:mRequest.contentURL.data() + length:mRequest.contentURL.size() + encoding:NSUTF8StringEncoding]; + if (mRequest.displayString.HasValue()) { + params.displayString = + [[NSString alloc] initWithBytes:mRequest.displayString.Value().data() + length:mRequest.displayString.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + params.displayString = nil; + } + if (mRequest.brandingInformation.HasValue()) { + params.brandingInformation = + [MTRContentLauncherClusterBrandingInformation new]; + params.brandingInformation.providerName = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value().providerName.data() + length:mRequest.brandingInformation.Value().providerName.size() + encoding:NSUTF8StringEncoding]; + if (mRequest.brandingInformation.Value().background.HasValue()) { + params.brandingInformation.background = + [MTRContentLauncherClusterStyleInformation new]; + if (mRequest.brandingInformation.Value() + .background.Value() + .imageUrl.HasValue()) { + params.brandingInformation.background.imageUrl = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .background.Value() + .imageUrl.Value() + .data() + length:mRequest.brandingInformation.Value() + .background.Value() + .imageUrl.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.background.imageUrl = nil; + } + if (mRequest.brandingInformation.Value() + .background.Value() + .color.HasValue()) { + params.brandingInformation.background.color = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .background.Value() + .color.Value() + .data() + length:mRequest.brandingInformation.Value() + .background.Value() + .color.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.background.color = nil; + } + if (mRequest.brandingInformation.Value() + .background.Value() + .size.HasValue()) { + params.brandingInformation.background.size = + [MTRContentLauncherClusterDimension new]; + params.brandingInformation.background.size.width = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .background.Value() + .size.Value() + .width]; + params.brandingInformation.background.size.height = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .background.Value() + .size.Value() + .height]; + params.brandingInformation.background.size.metric = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.brandingInformation.Value() + .background.Value() + .size.Value() + .metric)]; + } else { + params.brandingInformation.background.size = nil; + } + } else { + params.brandingInformation.background = nil; + } + if (mRequest.brandingInformation.Value().logo.HasValue()) { + params.brandingInformation.logo = + [MTRContentLauncherClusterStyleInformation new]; + if (mRequest.brandingInformation.Value() + .logo.Value() + .imageUrl.HasValue()) { + params.brandingInformation.logo.imageUrl = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .logo.Value() + .imageUrl.Value() + .data() + length:mRequest.brandingInformation.Value() + .logo.Value() + .imageUrl.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.logo.imageUrl = nil; + } + if (mRequest.brandingInformation.Value() + .logo.Value() + .color.HasValue()) { + params.brandingInformation.logo.color = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .logo.Value() + .color.Value() + .data() + length:mRequest.brandingInformation.Value() + .logo.Value() + .color.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.logo.color = nil; + } + if (mRequest.brandingInformation.Value().logo.Value().size.HasValue()) { + params.brandingInformation.logo.size = + [MTRContentLauncherClusterDimension new]; + params.brandingInformation.logo.size.width = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .logo.Value() + .size.Value() + .width]; + params.brandingInformation.logo.size.height = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .logo.Value() + .size.Value() + .height]; + params.brandingInformation.logo.size.metric = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.brandingInformation.Value() + .logo.Value() + .size.Value() + .metric)]; + } else { + params.brandingInformation.logo.size = nil; + } + } else { + params.brandingInformation.logo = nil; + } + if (mRequest.brandingInformation.Value().progressBar.HasValue()) { + params.brandingInformation.progressBar = + [MTRContentLauncherClusterStyleInformation new]; + if (mRequest.brandingInformation.Value() + .progressBar.Value() + .imageUrl.HasValue()) { + params.brandingInformation.progressBar.imageUrl = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .progressBar.Value() + .imageUrl.Value() + .data() + length:mRequest.brandingInformation.Value() + .progressBar.Value() + .imageUrl.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.progressBar.imageUrl = nil; + } + if (mRequest.brandingInformation.Value() + .progressBar.Value() + .color.HasValue()) { + params.brandingInformation.progressBar.color = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .progressBar.Value() + .color.Value() + .data() + length:mRequest.brandingInformation.Value() + .progressBar.Value() + .color.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.progressBar.color = nil; + } + if (mRequest.brandingInformation.Value() + .progressBar.Value() + .size.HasValue()) { + params.brandingInformation.progressBar.size = + [MTRContentLauncherClusterDimension new]; + params.brandingInformation.progressBar.size.width = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .progressBar.Value() + .size.Value() + .width]; + params.brandingInformation.progressBar.size.height = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .progressBar.Value() + .size.Value() + .height]; + params.brandingInformation.progressBar.size.metric = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.brandingInformation.Value() + .progressBar.Value() + .size.Value() + .metric)]; + } else { + params.brandingInformation.progressBar.size = nil; + } + } else { + params.brandingInformation.progressBar = nil; + } + if (mRequest.brandingInformation.Value().splash.HasValue()) { + params.brandingInformation.splash = + [MTRContentLauncherClusterStyleInformation new]; + if (mRequest.brandingInformation.Value() + .splash.Value() + .imageUrl.HasValue()) { + params.brandingInformation.splash.imageUrl = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .splash.Value() + .imageUrl.Value() + .data() + length:mRequest.brandingInformation.Value() + .splash.Value() + .imageUrl.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.splash.imageUrl = nil; + } + if (mRequest.brandingInformation.Value() + .splash.Value() + .color.HasValue()) { + params.brandingInformation.splash.color = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .splash.Value() + .color.Value() + .data() + length:mRequest.brandingInformation.Value() + .splash.Value() + .color.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.splash.color = nil; + } + if (mRequest.brandingInformation.Value() + .splash.Value() + .size.HasValue()) { + params.brandingInformation.splash.size = + [MTRContentLauncherClusterDimension new]; + params.brandingInformation.splash.size.width = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .splash.Value() + .size.Value() + .width]; + params.brandingInformation.splash.size.height = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .splash.Value() + .size.Value() + .height]; + params.brandingInformation.splash.size.metric = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.brandingInformation.Value() + .splash.Value() + .size.Value() + .metric)]; + } else { + params.brandingInformation.splash.size = nil; + } + } else { + params.brandingInformation.splash = nil; + } + if (mRequest.brandingInformation.Value().waterMark.HasValue()) { + params.brandingInformation.waterMark = + [MTRContentLauncherClusterStyleInformation new]; + if (mRequest.brandingInformation.Value() + .waterMark.Value() + .imageUrl.HasValue()) { + params.brandingInformation.waterMark.imageUrl = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .waterMark.Value() + .imageUrl.Value() + .data() + length:mRequest.brandingInformation.Value() + .waterMark.Value() + .imageUrl.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.waterMark.imageUrl = nil; + } + if (mRequest.brandingInformation.Value() + .waterMark.Value() + .color.HasValue()) { + params.brandingInformation.waterMark.color = [[NSString alloc] + initWithBytes:mRequest.brandingInformation.Value() + .waterMark.Value() + .color.Value() + .data() + length:mRequest.brandingInformation.Value() + .waterMark.Value() + .color.Value() + .size() + encoding:NSUTF8StringEncoding]; + } else { + params.brandingInformation.waterMark.color = nil; + } + if (mRequest.brandingInformation.Value() + .waterMark.Value() + .size.HasValue()) { + params.brandingInformation.waterMark.size = + [MTRContentLauncherClusterDimension new]; + params.brandingInformation.waterMark.size.width = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .waterMark.Value() + .size.Value() + .width]; + params.brandingInformation.waterMark.size.height = + [NSNumber numberWithDouble:mRequest.brandingInformation.Value() + .waterMark.Value() + .size.Value() + .height]; + params.brandingInformation.waterMark.size.metric = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.brandingInformation.Value() + .waterMark.Value() + .size.Value() + .metric)]; + } else { + params.brandingInformation.waterMark.size = nil; + } + } else { + params.brandingInformation.waterMark = nil; + } + } else { + params.brandingInformation = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLaunchResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type mRequest; + TypedComplexArgument> + mComplex_BrandingInformation; }; -class SubscribeAttributeElectricalMeasurementActivePower : public SubscribeAttribute { +/* + * Attribute AcceptHeader + */ +class ReadContentLauncherAcceptHeader : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePower() - : SubscribeAttribute("active-power") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePower response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadContentLauncherAcceptHeader() : ReadAttribute("accept-header") {} + + ~ReadContentLauncherAcceptHeader() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptHeaderWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); + if (error != nil) { + LogNSError("ContentLauncher AcceptHeader read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeContentLauncherAcceptHeader + : public SubscribeAttribute { +public: + SubscribeAttributeContentLauncherAcceptHeader() + : SubscribeAttribute("accept-header") {} + + ~SubscribeAttributeContentLauncherAcceptHeader() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptHeaderWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AcceptHeader response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerMin + * Attribute SupportedStreamingProtocols */ -class ReadElectricalMeasurementActivePowerMin : public ReadAttribute { +class ReadContentLauncherSupportedStreamingProtocols : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerMin() - : ReadAttribute("active-power-min") - { - } - - ~ReadElectricalMeasurementActivePowerMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMin response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMin read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadContentLauncherSupportedStreamingProtocols() + : ReadAttribute("supported-streaming-protocols") {} + + ~ReadContentLauncherSupportedStreamingProtocols() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedStreamingProtocolsWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", + [value description]); + if (error != nil) { + LogNSError("ContentLauncher SupportedStreamingProtocols read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerMin : public SubscribeAttribute { +class WriteContentLauncherSupportedStreamingProtocols : public WriteAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerMin() - : SubscribeAttribute("active-power-min") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerMin() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerMinWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMin response %@", [value description]); - SetCommandExitStatus(error); - }]; + WriteContentLauncherSupportedStreamingProtocols() + : WriteAttribute("supported-streaming-protocols") { + AddArgument("attr-name", "supported-streaming-protocols"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteContentLauncherSupportedStreamingProtocols() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeSupportedStreamingProtocolsWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ContentLauncher " + "SupportedStreamingProt" + "ocols write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - return CHIP_NO_ERROR; - } +private: + uint32_t mValue; }; -/* - * Attribute ActivePowerMax - */ -class ReadElectricalMeasurementActivePowerMax : public ReadAttribute { +class SubscribeAttributeContentLauncherSupportedStreamingProtocols + : public SubscribeAttribute { public: - ReadElectricalMeasurementActivePowerMax() - : ReadAttribute("active-power-max") - { - } + SubscribeAttributeContentLauncherSupportedStreamingProtocols() + : SubscribeAttribute("supported-streaming-protocols") {} - ~ReadElectricalMeasurementActivePowerMax() {} + ~SubscribeAttributeContentLauncherSupportedStreamingProtocols() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMax response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMax read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -class SubscribeAttributeElectricalMeasurementActivePowerMax : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementActivePowerMax() - : SubscribeAttribute("active-power-max") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeElectricalMeasurementActivePowerMax() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedStreamingProtocolsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActivePowerMaxWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMax response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ReactivePower + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementReactivePower : public ReadAttribute { -public: - ReadElectricalMeasurementReactivePower() - : ReadAttribute("reactive-power") - { - } - - ~ReadElectricalMeasurementReactivePower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReactivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ReactivePower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementReactivePower : public SubscribeAttribute { +class ReadContentLauncherGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementReactivePower() - : SubscribeAttribute("reactive-power") - { - } - - ~SubscribeAttributeElectricalMeasurementReactivePower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeReactivePowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePower response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadContentLauncherGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadContentLauncherGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ContentLauncher GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeContentLauncherGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeContentLauncherGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeContentLauncherGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ApparentPower + * Attribute AcceptedCommandList */ -class ReadElectricalMeasurementApparentPower : public ReadAttribute { +class ReadContentLauncherAcceptedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementApparentPower() - : ReadAttribute("apparent-power") - { - } - - ~ReadElectricalMeasurementApparentPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000050F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApparentPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPower response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ApparentPower read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadContentLauncherAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadContentLauncherAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ContentLauncher AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeContentLauncherAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeContentLauncherAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeContentLauncherAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementApparentPower : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadContentLauncherAttributeList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementApparentPower() - : SubscribeAttribute("apparent-power") - { - } - - ~SubscribeAttributeElectricalMeasurementApparentPower() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000050F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApparentPowerWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPower response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadContentLauncherAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadContentLauncherAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("ContentLauncher AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeContentLauncherAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeContentLauncherAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeContentLauncherAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PowerFactor + * Attribute FeatureMap */ -class ReadElectricalMeasurementPowerFactor : public ReadAttribute { +class ReadContentLauncherFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementPowerFactor() - : ReadAttribute("power-factor") - { - } - - ~ReadElectricalMeasurementPowerFactor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000510) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerFactorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PowerFactor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadContentLauncherFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadContentLauncherFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ContentLauncher FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPowerFactor : public SubscribeAttribute { +class SubscribeAttributeContentLauncherFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementPowerFactor() - : SubscribeAttribute("power-factor") - { - } + SubscribeAttributeContentLauncherFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementPowerFactor() {} + ~SubscribeAttributeContentLauncherFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000510) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributePowerFactorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsVoltageMeasurementPeriod + * Attribute ClusterRevision */ -class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod : public ReadAttribute { +class ReadContentLauncherClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod() - : ReadAttribute("average-rms-voltage-measurement-period") - { - } - - ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000511) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeAverageRmsVoltageMeasurementPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriod response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsVoltageMeasurementPeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadContentLauncherClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadContentLauncherClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("ContentLauncher ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeContentLauncherClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeContentLauncherClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeContentLauncherClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050A) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterContentLauncher alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ContentLauncher.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod : public WriteAttribute { -public: - WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod() - : WriteAttribute("average-rms-voltage-measurement-period") - { - AddArgument("attr-name", "average-rms-voltage-measurement-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000511) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; +/*----------------------------------------------------------------------------*\ +| Cluster AudioOutput | 0x050B | +|------------------------------------------------------------------------------| +| Commands: | | +| * SelectOutput | 0x00 | +| * RenameOutput | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * OutputList | 0x0000 | +| * CurrentOutput | 0x0001 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ - [cluster writeAttributeAverageRmsVoltageMeasurementPeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ElectricalMeasurement " - "AverageRmsVoltageMeasurementPeriod write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; +/* + * Command SelectOutput + */ +class AudioOutputSelectOutput : public ClusterCommand { +public: + AudioOutputSelectOutput() : ClusterCommand("select-output") { + AddArgument("Index", 0, UINT8_MAX, &mRequest.index); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050B) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAudioOutputClusterSelectOutputParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster selectOutputWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod : public SubscribeAttribute { +/* + * Command RenameOutput + */ +class AudioOutputRenameOutput : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod() - : SubscribeAttribute("average-rms-voltage-measurement-period") - { + AudioOutputRenameOutput() : ClusterCommand("rename-output") { + AddArgument("Index", 0, UINT8_MAX, &mRequest.index); + AddArgument("Name", &mRequest.name); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050B) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAudioOutputClusterRenameOutputParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; + params.name = [[NSString alloc] initWithBytes:mRequest.name.data() + length:mRequest.name.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster renameOutputWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000511) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsVoltageMeasurementPeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type mRequest; }; /* - * Attribute AverageRmsUnderVoltageCounter + * Attribute OutputList */ -class ReadElectricalMeasurementAverageRmsUnderVoltageCounter : public ReadAttribute { +class ReadAudioOutputOutputList : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsUnderVoltageCounter() - : ReadAttribute("average-rms-under-voltage-counter") - { - } - - ~ReadElectricalMeasurementAverageRmsUnderVoltageCounter() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000513) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsUnderVoltageCounterWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounter response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsUnderVoltageCounter read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAudioOutputOutputList() : ReadAttribute("output-list") {} + + ~ReadAudioOutputOutputList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOutputListWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AudioOutput.OutputList response %@", [value description]); + if (error != nil) { + LogNSError("AudioOutput OutputList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementAverageRmsUnderVoltageCounter : public WriteAttribute { +class SubscribeAttributeAudioOutputOutputList : public SubscribeAttribute { public: - WriteElectricalMeasurementAverageRmsUnderVoltageCounter() - : WriteAttribute("average-rms-under-voltage-counter") - { - AddArgument("attr-name", "average-rms-under-voltage-counter"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementAverageRmsUnderVoltageCounter() {} + SubscribeAttributeAudioOutputOutputList() + : SubscribeAttribute("output-list") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000513) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + ~SubscribeAttributeAudioOutputOutputList() {} - [cluster - writeAttributeAverageRmsUnderVoltageCounterWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "ElectricalMeasurement AverageRmsUnderVoltageCounter write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOutputListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.OutputList response %@", [value description]); + SetCommandExitStatus(error); + }]; -private: - uint16_t mValue; + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute CurrentOutput + */ +class ReadAudioOutputCurrentOutput : public ReadAttribute { +public: + ReadAudioOutputCurrentOutput() : ReadAttribute("current-output") {} + + ~ReadAudioOutputCurrentOutput() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentOutputWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); + if (error != nil) { + LogNSError("AudioOutput CurrentOutput read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter : public SubscribeAttribute { +class SubscribeAttributeAudioOutputCurrentOutput : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter() - : SubscribeAttribute("average-rms-under-voltage-counter") - { - } + SubscribeAttributeAudioOutputCurrentOutput() + : SubscribeAttribute("current-output") {} - ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter() {} + ~SubscribeAttributeAudioOutputCurrentOutput() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000513) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentOutputWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAverageRmsUnderVoltageCounterWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounter response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeOverVoltagePeriod + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementRmsExtremeOverVoltagePeriod : public ReadAttribute { +class ReadAudioOutputGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeOverVoltagePeriod() - : ReadAttribute("rms-extreme-over-voltage-period") - { - } - - ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000514) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsExtremeOverVoltagePeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriod response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeOverVoltagePeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAudioOutputGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadAudioOutputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AudioOutput GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAudioOutputGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAudioOutputGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeAudioOutputGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementRmsExtremeOverVoltagePeriod : public WriteAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadAudioOutputAcceptedCommandList : public ReadAttribute { public: - WriteElectricalMeasurementRmsExtremeOverVoltagePeriod() - : WriteAttribute("rms-extreme-over-voltage-period") - { - AddArgument("attr-name", "rms-extreme-over-voltage-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementRmsExtremeOverVoltagePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000514) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeRmsExtremeOverVoltagePeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "ElectricalMeasurement RmsExtremeOverVoltagePeriod write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAudioOutputAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadAudioOutputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AudioOutput AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAudioOutputAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAudioOutputAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeAudioOutputAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; -private: - uint16_t mValue; +/* + * Attribute AttributeList + */ +class ReadAudioOutputAttributeList : public ReadAttribute { +public: + ReadAudioOutputAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadAudioOutputAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("AudioOutput AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod : public SubscribeAttribute { +class SubscribeAttributeAudioOutputAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod() - : SubscribeAttribute("rms-extreme-over-voltage-period") - { - } + SubscribeAttributeAudioOutputAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod() {} + ~SubscribeAttributeAudioOutputAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000514) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsExtremeOverVoltagePeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeUnderVoltagePeriod + * Attribute FeatureMap */ -class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod : public ReadAttribute { +class ReadAudioOutputFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod() - : ReadAttribute("rms-extreme-under-voltage-period") - { - } - - ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000515) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsExtremeUnderVoltagePeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriod response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeUnderVoltagePeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAudioOutputFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadAudioOutputFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AudioOutput.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("AudioOutput FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod : public WriteAttribute { +class SubscribeAttributeAudioOutputFeatureMap : public SubscribeAttribute { public: - WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod() - : WriteAttribute("rms-extreme-under-voltage-period") - { - AddArgument("attr-name", "rms-extreme-under-voltage-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} + SubscribeAttributeAudioOutputFeatureMap() + : SubscribeAttribute("feature-map") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000515) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + ~SubscribeAttributeAudioOutputFeatureMap() {} - [cluster - writeAttributeRmsExtremeUnderVoltagePeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "ElectricalMeasurement RmsExtremeUnderVoltagePeriod write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } - -private: - uint16_t mValue; -}; - -class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod() - : SubscribeAttribute("rms-extreme-under-voltage-period") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000515) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsExtremeUnderVoltagePeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSagPeriod + * Attribute ClusterRevision */ -class ReadElectricalMeasurementRmsVoltageSagPeriod : public ReadAttribute { +class ReadAudioOutputClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageSagPeriod() - : ReadAttribute("rms-voltage-sag-period") - { - } + ReadAudioOutputClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadAudioOutputClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("AudioOutput ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementRmsVoltageSagPeriod() {} +class SubscribeAttributeAudioOutputClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeAudioOutputClusterRevision() + : SubscribeAttribute("cluster-revision") {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000516) on endpoint %u", endpointId); + ~SubscribeAttributeAudioOutputClusterRevision() {} - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSagPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriod response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSagPeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050B) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAudioOutput alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AudioOutput.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementRmsVoltageSagPeriod : public WriteAttribute { +/*----------------------------------------------------------------------------*\ +| Cluster ApplicationLauncher | 0x050C | +|------------------------------------------------------------------------------| +| Commands: | | +| * LaunchApp | 0x00 | +| * StopApp | 0x01 | +| * HideApp | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CatalogList | 0x0000 | +| * CurrentApp | 0x0001 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command LaunchApp + */ +class ApplicationLauncherLaunchApp : public ClusterCommand { public: - WriteElectricalMeasurementRmsVoltageSagPeriod() - : WriteAttribute("rms-voltage-sag-period") - { - AddArgument("attr-name", "rms-voltage-sag-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementRmsVoltageSagPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000516) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeRmsVoltageSagPeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSagPeriod write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + ApplicationLauncherLaunchApp() + : ClusterCommand("launch-app"), + mComplex_Application(&mRequest.application) { + AddArgument("Application", &mComplex_Application); + AddArgument("Data", &mRequest.data); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050C) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.application = [MTRApplicationLauncherClusterApplication new]; + params.application.catalogVendorId = + [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; + params.application.applicationId = [[NSString alloc] + initWithBytes:mRequest.application.applicationId.data() + length:mRequest.application.applicationId.size() + encoding:NSUTF8StringEncoding]; + if (mRequest.data.HasValue()) { + params.data = [NSData dataWithBytes:mRequest.data.Value().data() + length:mRequest.data.Value().size()]; + } else { + params.data = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster launchAppWithParams:params + completion:^( + MTRApplicationLauncherClusterLauncherResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::ApplicationLauncher::Structs::Application::Type> + mComplex_Application; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod : public SubscribeAttribute { +/* + * Command StopApp + */ +class ApplicationLauncherStopApp : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod() - : SubscribeAttribute("rms-voltage-sag-period") - { + ApplicationLauncherStopApp() + : ClusterCommand("stop-app"), + mComplex_Application(&mRequest.application) { + AddArgument("Application", &mComplex_Application); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050C) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRApplicationLauncherClusterStopAppParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.application = [MTRApplicationLauncherClusterApplication new]; + params.application.catalogVendorId = + [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; + params.application.applicationId = [[NSString alloc] + initWithBytes:mRequest.application.applicationId.data() + length:mRequest.application.applicationId.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopAppWithParams:params + completion:^( + MTRApplicationLauncherClusterLauncherResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000516) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageSagPeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::ApplicationLauncher::Structs::Application::Type> + mComplex_Application; }; /* - * Attribute RmsVoltageSwellPeriod + * Command HideApp */ -class ReadElectricalMeasurementRmsVoltageSwellPeriod : public ReadAttribute { +class ApplicationLauncherHideApp : public ClusterCommand { public: - ReadElectricalMeasurementRmsVoltageSwellPeriod() - : ReadAttribute("rms-voltage-swell-period") - { + ApplicationLauncherHideApp() + : ClusterCommand("hide-app"), + mComplex_Application(&mRequest.application) { + AddArgument("Application", &mComplex_Application); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050C) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRApplicationLauncherClusterHideAppParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.application = [MTRApplicationLauncherClusterApplication new]; + params.application.catalogVendorId = + [NSNumber numberWithUnsignedShort:mRequest.application.catalogVendorId]; + params.application.applicationId = [[NSString alloc] + initWithBytes:mRequest.application.applicationId.data() + length:mRequest.application.applicationId.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster hideAppWithParams:params + completion:^( + MTRApplicationLauncherClusterLauncherResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementRmsVoltageSwellPeriod() {} +private: + chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::ApplicationLauncher::Structs::Application::Type> + mComplex_Application; +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000517) on endpoint %u", endpointId); +/* + * Attribute CatalogList + */ +class ReadApplicationLauncherCatalogList : public ReadAttribute { +public: + ReadApplicationLauncherCatalogList() : ReadAttribute("catalog-list") {} + + ~ReadApplicationLauncherCatalogList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCatalogListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.CatalogList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher CatalogList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherCatalogList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherCatalogList() + : SubscribeAttribute("catalog-list") {} + + ~SubscribeAttributeApplicationLauncherCatalogList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCatalogListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.CatalogList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSwellPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriod response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSwellPeriod read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute CurrentApp + */ +class ReadApplicationLauncherCurrentApp : public ReadAttribute { +public: + ReadApplicationLauncherCurrentApp() : ReadAttribute("current-app") {} + + ~ReadApplicationLauncherCurrentApp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentAppWithCompletion:^( + MTRApplicationLauncherClusterApplicationEP *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher CurrentApp read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementRmsVoltageSwellPeriod : public WriteAttribute { +class WriteApplicationLauncherCurrentApp : public WriteAttribute { public: - WriteElectricalMeasurementRmsVoltageSwellPeriod() - : WriteAttribute("rms-voltage-swell-period") - { - AddArgument("attr-name", "rms-voltage-swell-period"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementRmsVoltageSwellPeriod() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000517) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeRmsVoltageSwellPeriodWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSwellPeriod write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteApplicationLauncherCurrentApp() + : WriteAttribute("current-app"), mComplex(&mValue) { + AddArgument("attr-name", "current-app"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteApplicationLauncherCurrentApp() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + MTRApplicationLauncherClusterApplicationEP *_Nullable value; + if (mValue.IsNull()) { + value = nil; + } else { + value = [MTRApplicationLauncherClusterApplicationEP new]; + value.application = [MTRApplicationLauncherClusterApplication new]; + value.application.catalogVendorId = [NSNumber + numberWithUnsignedShort:mValue.Value().application.catalogVendorId]; + value.application.applicationId = [[NSString alloc] + initWithBytes:mValue.Value().application.applicationId.data() + length:mValue.Value().application.applicationId.size() + encoding:NSUTF8StringEncoding]; + if (mValue.Value().endpoint.HasValue()) { + value.endpoint = + [NSNumber numberWithUnsignedShort:mValue.Value().endpoint.Value()]; + } else { + value.endpoint = nil; + } + } + + [cluster writeAttributeCurrentAppWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ApplicationLauncher " + "CurrentApp write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + chip::app::DataModel::Nullable< + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod : public SubscribeAttribute { +class SubscribeAttributeApplicationLauncherCurrentApp + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod() - : SubscribeAttribute("rms-voltage-swell-period") - { - } + SubscribeAttributeApplicationLauncherCurrentApp() + : SubscribeAttribute("current-app") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod() {} + ~SubscribeAttributeApplicationLauncherCurrentApp() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000517) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentAppWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageSwellPeriodWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriod response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^( + MTRApplicationLauncherClusterApplicationEP *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.CurrentApp response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcVoltageMultiplier + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementAcVoltageMultiplier : public ReadAttribute { +class ReadApplicationLauncherGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementAcVoltageMultiplier() - : ReadAttribute("ac-voltage-multiplier") - { - } - - ~ReadElectricalMeasurementAcVoltageMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000600) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcVoltageMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcVoltageMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationLauncherGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadApplicationLauncherGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeApplicationLauncherGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcVoltageMultiplier : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadApplicationLauncherAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAcVoltageMultiplier() - : SubscribeAttribute("ac-voltage-multiplier") - { - } + ReadApplicationLauncherAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadApplicationLauncherAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeApplicationLauncherAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementAcVoltageMultiplier() {} +/* + * Attribute AttributeList + */ +class ReadApplicationLauncherAttributeList : public ReadAttribute { +public: + ReadApplicationLauncherAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadApplicationLauncherAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeApplicationLauncherAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000600) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcVoltageMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute FeatureMap + */ +class ReadApplicationLauncherFeatureMap : public ReadAttribute { +public: + ReadApplicationLauncherFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadApplicationLauncherFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeApplicationLauncherFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ClusterRevision + */ +class ReadApplicationLauncherClusterRevision : public ReadAttribute { +public: + ReadApplicationLauncherClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadApplicationLauncherClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationLauncher ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationLauncherClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationLauncherClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeApplicationLauncherClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050C) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterApplicationLauncher alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationLauncher.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; +/*----------------------------------------------------------------------------*\ +| Cluster ApplicationBasic | 0x050D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * VendorName | 0x0000 | +| * VendorID | 0x0001 | +| * ApplicationName | 0x0002 | +| * ProductID | 0x0003 | +| * Application | 0x0004 | +| * Status | 0x0005 | +| * ApplicationVersion | 0x0006 | +| * AllowedVendorList | 0x0007 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /* - * Attribute AcVoltageDivisor + * Attribute VendorName */ -class ReadElectricalMeasurementAcVoltageDivisor : public ReadAttribute { +class ReadApplicationBasicVendorName : public ReadAttribute { public: - ReadElectricalMeasurementAcVoltageDivisor() - : ReadAttribute("ac-voltage-divisor") - { - } - - ~ReadElectricalMeasurementAcVoltageDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000601) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcVoltageDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcVoltageDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicVendorName() : ReadAttribute("vendor-name") {} + + ~ReadApplicationBasicVendorName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorNameWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.VendorName response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic VendorName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcVoltageDivisor : public SubscribeAttribute { +class SubscribeAttributeApplicationBasicVendorName : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcVoltageDivisor() - : SubscribeAttribute("ac-voltage-divisor") - { - } + SubscribeAttributeApplicationBasicVendorName() + : SubscribeAttribute("vendor-name") {} - ~SubscribeAttributeElectricalMeasurementAcVoltageDivisor() {} + ~SubscribeAttributeApplicationBasicVendorName() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000601) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcVoltageDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.VendorName response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcCurrentMultiplier + * Attribute VendorID */ -class ReadElectricalMeasurementAcCurrentMultiplier : public ReadAttribute { +class ReadApplicationBasicVendorID : public ReadAttribute { public: - ReadElectricalMeasurementAcCurrentMultiplier() - : ReadAttribute("ac-current-multiplier") - { - } - - ~ReadElectricalMeasurementAcCurrentMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000602) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcCurrentMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcCurrentMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicVendorID() : ReadAttribute("vendor-id") {} + + ~ReadApplicationBasicVendorID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorIDWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.VendorID response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic VendorID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcCurrentMultiplier : public SubscribeAttribute { +class SubscribeAttributeApplicationBasicVendorID : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcCurrentMultiplier() - : SubscribeAttribute("ac-current-multiplier") - { - } + SubscribeAttributeApplicationBasicVendorID() + : SubscribeAttribute("vendor-id") {} - ~SubscribeAttributeElectricalMeasurementAcCurrentMultiplier() {} + ~SubscribeAttributeApplicationBasicVendorID() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000602) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcCurrentMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.VendorID response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcCurrentDivisor + * Attribute ApplicationName */ -class ReadElectricalMeasurementAcCurrentDivisor : public ReadAttribute { -public: - ReadElectricalMeasurementAcCurrentDivisor() - : ReadAttribute("ac-current-divisor") - { - } - - ~ReadElectricalMeasurementAcCurrentDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000603) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcCurrentDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcCurrentDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementAcCurrentDivisor : public SubscribeAttribute { +class ReadApplicationBasicApplicationName : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAcCurrentDivisor() - : SubscribeAttribute("ac-current-divisor") - { - } - - ~SubscribeAttributeElectricalMeasurementAcCurrentDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000603) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcCurrentDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadApplicationBasicApplicationName() : ReadAttribute("application-name") {} + + ~ReadApplicationBasicApplicationName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApplicationNameWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ApplicationName response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic ApplicationName read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicApplicationName + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicApplicationName() + : SubscribeAttribute("application-name") {} + + ~SubscribeAttributeApplicationBasicApplicationName() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApplicationNameWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ApplicationName response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcPowerMultiplier + * Attribute ProductID */ -class ReadElectricalMeasurementAcPowerMultiplier : public ReadAttribute { +class ReadApplicationBasicProductID : public ReadAttribute { public: - ReadElectricalMeasurementAcPowerMultiplier() - : ReadAttribute("ac-power-multiplier") - { - } - - ~ReadElectricalMeasurementAcPowerMultiplier() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000604) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcPowerMultiplierWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcPowerMultiplier response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcPowerMultiplier read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicProductID() : ReadAttribute("product-id") {} + + ~ReadApplicationBasicProductID() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeProductIDWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ProductID response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic ProductID read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcPowerMultiplier : public SubscribeAttribute { +class SubscribeAttributeApplicationBasicProductID : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcPowerMultiplier() - : SubscribeAttribute("ac-power-multiplier") - { - } + SubscribeAttributeApplicationBasicProductID() + : SubscribeAttribute("product-id") {} - ~SubscribeAttributeElectricalMeasurementAcPowerMultiplier() {} + ~SubscribeAttributeApplicationBasicProductID() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000604) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProductIDWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcPowerMultiplierWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcPowerMultiplier response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ProductID response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcPowerDivisor + * Attribute Application */ -class ReadElectricalMeasurementAcPowerDivisor : public ReadAttribute { +class ReadApplicationBasicApplication : public ReadAttribute { public: - ReadElectricalMeasurementAcPowerDivisor() - : ReadAttribute("ac-power-divisor") - { - } - - ~ReadElectricalMeasurementAcPowerDivisor() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000605) on endpoint %u", endpointId); + ReadApplicationBasicApplication() : ReadAttribute("application") {} + + ~ReadApplicationBasicApplication() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApplicationWithCompletion:^( + MTRApplicationBasicClusterApplicationBasicApplication + *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.Application response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic Application read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicApplication + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicApplication() + : SubscribeAttribute("application") {} + + ~SubscribeAttributeApplicationBasicApplication() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApplicationWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(MTRApplicationBasicClusterApplicationBasicApplication + *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.Application response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcPowerDivisorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcPowerDivisor response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcPowerDivisor read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute Status + */ +class ReadApplicationBasicStatus : public ReadAttribute { +public: + ReadApplicationBasicStatus() : ReadAttribute("status") {} + + ~ReadApplicationBasicStatus() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStatusWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.Status response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic Status read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcPowerDivisor : public SubscribeAttribute { +class SubscribeAttributeApplicationBasicStatus : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcPowerDivisor() - : SubscribeAttribute("ac-power-divisor") - { - } + SubscribeAttributeApplicationBasicStatus() : SubscribeAttribute("status") {} - ~SubscribeAttributeElectricalMeasurementAcPowerDivisor() {} + ~SubscribeAttributeApplicationBasicStatus() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000605) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStatusWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcPowerDivisorWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcPowerDivisor response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.Status response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute OverloadAlarmsMask + * Attribute ApplicationVersion */ -class ReadElectricalMeasurementOverloadAlarmsMask : public ReadAttribute { +class ReadApplicationBasicApplicationVersion : public ReadAttribute { public: - ReadElectricalMeasurementOverloadAlarmsMask() - : ReadAttribute("overload-alarms-mask") - { - } - - ~ReadElectricalMeasurementOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000700) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOverloadAlarmsMaskWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.OverloadAlarmsMask response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement OverloadAlarmsMask read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicApplicationVersion() + : ReadAttribute("application-version") {} + + ~ReadApplicationBasicApplicationVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApplicationVersionWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ApplicationVersion response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic ApplicationVersion read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicApplicationVersion + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicApplicationVersion() + : SubscribeAttribute("application-version") {} + + ~SubscribeAttributeApplicationBasicApplicationVersion() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApplicationVersionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ApplicationVersion response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementOverloadAlarmsMask : public WriteAttribute { +/* + * Attribute AllowedVendorList + */ +class ReadApplicationBasicAllowedVendorList : public ReadAttribute { public: - WriteElectricalMeasurementOverloadAlarmsMask() - : WriteAttribute("overload-alarms-mask") - { - AddArgument("attr-name", "overload-alarms-mask"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000700) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeOverloadAlarmsMaskWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ElectricalMeasurement OverloadAlarmsMask write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; + ReadApplicationBasicAllowedVendorList() + : ReadAttribute("allowed-vendor-list") {} + + ~ReadApplicationBasicAllowedVendorList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAllowedVendorListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AllowedVendorList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic AllowedVendorList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicAllowedVendorList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicAllowedVendorList() + : SubscribeAttribute("allowed-vendor-list") {} + + ~SubscribeAttributeApplicationBasicAllowedVendorList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAllowedVendorListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AllowedVendorList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementOverloadAlarmsMask : public SubscribeAttribute { +/* + * Attribute GeneratedCommandList + */ +class ReadApplicationBasicGeneratedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementOverloadAlarmsMask() - : SubscribeAttribute("overload-alarms-mask") - { - } - - ~SubscribeAttributeElectricalMeasurementOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000700) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeOverloadAlarmsMaskWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.OverloadAlarmsMask response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadApplicationBasicGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadApplicationBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeApplicationBasicGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute VoltageOverload + * Attribute AcceptedCommandList */ -class ReadElectricalMeasurementVoltageOverload : public ReadAttribute { +class ReadApplicationBasicAcceptedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementVoltageOverload() - : ReadAttribute("voltage-overload") - { - } - - ~ReadElectricalMeasurementVoltageOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000701) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVoltageOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.VoltageOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement VoltageOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadApplicationBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeApplicationBasicAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementVoltageOverload : public SubscribeAttribute { +/* + * Attribute AttributeList + */ +class ReadApplicationBasicAttributeList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementVoltageOverload() - : SubscribeAttribute("voltage-overload") - { - } - - ~SubscribeAttributeElectricalMeasurementVoltageOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000701) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeVoltageOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.VoltageOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadApplicationBasicAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadApplicationBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeApplicationBasicAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute CurrentOverload + * Attribute FeatureMap */ -class ReadElectricalMeasurementCurrentOverload : public ReadAttribute { +class ReadApplicationBasicFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementCurrentOverload() - : ReadAttribute("current-overload") - { - } - - ~ReadElectricalMeasurementCurrentOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000702) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCurrentOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.CurrentOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement CurrentOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadApplicationBasicFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ApplicationBasic.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ApplicationBasic FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementCurrentOverload : public SubscribeAttribute { +class SubscribeAttributeApplicationBasicFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementCurrentOverload() - : SubscribeAttribute("current-overload") - { - } + SubscribeAttributeApplicationBasicFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementCurrentOverload() {} + ~SubscribeAttributeApplicationBasicFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000702) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeCurrentOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.CurrentOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcOverloadAlarmsMask + * Attribute ClusterRevision */ -class ReadElectricalMeasurementAcOverloadAlarmsMask : public ReadAttribute { +class ReadApplicationBasicClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementAcOverloadAlarmsMask() - : ReadAttribute("ac-overload-alarms-mask") - { - } - - ~ReadElectricalMeasurementAcOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000800) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcOverloadAlarmsMaskWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcOverloadAlarmsMask response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcOverloadAlarmsMask read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadApplicationBasicClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadApplicationBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("ApplicationBasic ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeApplicationBasicClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeApplicationBasicClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeApplicationBasicClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050D) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ApplicationBasic.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class WriteElectricalMeasurementAcOverloadAlarmsMask : public WriteAttribute { -public: - WriteElectricalMeasurementAcOverloadAlarmsMask() - : WriteAttribute("ac-overload-alarms-mask") - { - AddArgument("attr-name", "ac-overload-alarms-mask"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteElectricalMeasurementAcOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) WriteAttribute (0x00000800) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeAcOverloadAlarmsMaskWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ElectricalMeasurement AcOverloadAlarmsMask write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint16_t mValue; -}; +/*----------------------------------------------------------------------------*\ +| Cluster AccountLogin | 0x050E | +|------------------------------------------------------------------------------| +| Commands: | | +| * GetSetupPIN | 0x00 | +| * Login | 0x02 | +| * Logout | 0x03 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ -class SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask : public SubscribeAttribute { +/* + * Command GetSetupPIN + */ +class AccountLoginGetSetupPIN : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask() - : SubscribeAttribute("ac-overload-alarms-mask") - { + AccountLoginGetSetupPIN() : ClusterCommand("get-setup-pin") { + AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050E) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRAccountLoginClusterGetSetupPINParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.tempAccountIdentifier = + [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() + length:mRequest.tempAccountIdentifier.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster getSetupPINWithParams:params + completion:^( + MTRAccountLoginClusterGetSetupPINResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000800) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcOverloadAlarmsMaskWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcOverloadAlarmsMask response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type mRequest; }; /* - * Attribute AcVoltageOverload + * Command Login */ -class ReadElectricalMeasurementAcVoltageOverload : public ReadAttribute { +class AccountLoginLogin : public ClusterCommand { public: - ReadElectricalMeasurementAcVoltageOverload() - : ReadAttribute("ac-voltage-overload") - { - } - - ~ReadElectricalMeasurementAcVoltageOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000801) on endpoint %u", endpointId); + AccountLoginLogin() : ClusterCommand("login") { + AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); + AddArgument("SetupPIN", &mRequest.setupPIN); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050E) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRAccountLoginClusterLoginParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.tempAccountIdentifier = + [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() + length:mRequest.tempAccountIdentifier.size() + encoding:NSUTF8StringEncoding]; + params.setupPIN = [[NSString alloc] initWithBytes:mRequest.setupPIN.data() + length:mRequest.setupPIN.size() + encoding:NSUTF8StringEncoding]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster loginWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcVoltageOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcVoltageOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::AccountLogin::Commands::Login::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementAcVoltageOverload : public SubscribeAttribute { +/* + * Command Logout + */ +class AccountLoginLogout : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementAcVoltageOverload() - : SubscribeAttribute("ac-voltage-overload") - { + AccountLoginLogout() : ClusterCommand("logout") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x0000050E) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRAccountLoginClusterLogoutParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster logoutWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementAcVoltageOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000801) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcVoltageOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcVoltageOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute AcCurrentOverload + * Attribute GeneratedCommandList */ -class ReadElectricalMeasurementAcCurrentOverload : public ReadAttribute { +class ReadAccountLoginGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementAcCurrentOverload() - : ReadAttribute("ac-current-overload") - { - } - - ~ReadElectricalMeasurementAcCurrentOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000802) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcCurrentOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcCurrentOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAccountLoginGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadAccountLoginGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AccountLogin GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccountLoginGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAccountLoginGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeAccountLoginGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcCurrentOverload : public SubscribeAttribute { +/* + * Attribute AcceptedCommandList + */ +class ReadAccountLoginAcceptedCommandList : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAcCurrentOverload() - : SubscribeAttribute("ac-current-overload") - { - } - - ~SubscribeAttributeElectricalMeasurementAcCurrentOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000802) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcCurrentOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcCurrentOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadAccountLoginAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadAccountLoginAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("AccountLogin AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccountLoginAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeAccountLoginAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeAccountLoginAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AcActivePowerOverload + * Attribute AttributeList */ -class ReadElectricalMeasurementAcActivePowerOverload : public ReadAttribute { +class ReadAccountLoginAttributeList : public ReadAttribute { public: - ReadElectricalMeasurementAcActivePowerOverload() - : ReadAttribute("ac-active-power-overload") - { - } - - ~ReadElectricalMeasurementAcActivePowerOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000803) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcActivePowerOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcActivePowerOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcActivePowerOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAccountLoginAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadAccountLoginAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("AccountLogin AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcActivePowerOverload : public SubscribeAttribute { +class SubscribeAttributeAccountLoginAttributeList : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcActivePowerOverload() - : SubscribeAttribute("ac-active-power-overload") - { - } + SubscribeAttributeAccountLoginAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeElectricalMeasurementAcActivePowerOverload() {} + ~SubscribeAttributeAccountLoginAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000803) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcActivePowerOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcActivePowerOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AcReactivePowerOverload + * Attribute FeatureMap */ -class ReadElectricalMeasurementAcReactivePowerOverload : public ReadAttribute { +class ReadAccountLoginFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementAcReactivePowerOverload() - : ReadAttribute("ac-reactive-power-overload") - { - } - - ~ReadElectricalMeasurementAcReactivePowerOverload() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000804) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcReactivePowerOverloadWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcReactivePowerOverload response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcReactivePowerOverload read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAccountLoginFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadAccountLoginFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"AccountLogin.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("AccountLogin FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAcReactivePowerOverload : public SubscribeAttribute { +class SubscribeAttributeAccountLoginFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementAcReactivePowerOverload() - : SubscribeAttribute("ac-reactive-power-overload") - { - } + SubscribeAttributeAccountLoginFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeElectricalMeasurementAcReactivePowerOverload() {} + ~SubscribeAttributeAccountLoginFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000804) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAcReactivePowerOverloadWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcReactivePowerOverload response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsOverVoltage + * Attribute ClusterRevision */ -class ReadElectricalMeasurementAverageRmsOverVoltage : public ReadAttribute { +class ReadAccountLoginClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsOverVoltage() - : ReadAttribute("average-rms-over-voltage") - { - } - - ~ReadElectricalMeasurementAverageRmsOverVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000805) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsOverVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsOverVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadAccountLoginClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadAccountLoginClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("AccountLogin ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccountLoginClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeAccountLoginClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeAccountLoginClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x0000050E) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterAccountLogin alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"AccountLogin.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage() - : SubscribeAttribute("average-rms-over-voltage") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000805) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsOverVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; +/*----------------------------------------------------------------------------*\ +| Cluster ElectricalMeasurement | 0x0B04 | +|------------------------------------------------------------------------------| +| Commands: | | +| * GetProfileInfoCommand | 0x00 | +| * GetMeasurementProfileCommand | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasurementType | 0x0000 | +| * DcVoltage | 0x0100 | +| * DcVoltageMin | 0x0101 | +| * DcVoltageMax | 0x0102 | +| * DcCurrent | 0x0103 | +| * DcCurrentMin | 0x0104 | +| * DcCurrentMax | 0x0105 | +| * DcPower | 0x0106 | +| * DcPowerMin | 0x0107 | +| * DcPowerMax | 0x0108 | +| * DcVoltageMultiplier | 0x0200 | +| * DcVoltageDivisor | 0x0201 | +| * DcCurrentMultiplier | 0x0202 | +| * DcCurrentDivisor | 0x0203 | +| * DcPowerMultiplier | 0x0204 | +| * DcPowerDivisor | 0x0205 | +| * AcFrequency | 0x0300 | +| * AcFrequencyMin | 0x0301 | +| * AcFrequencyMax | 0x0302 | +| * NeutralCurrent | 0x0303 | +| * TotalActivePower | 0x0304 | +| * TotalReactivePower | 0x0305 | +| * TotalApparentPower | 0x0306 | +| * Measured1stHarmonicCurrent | 0x0307 | +| * Measured3rdHarmonicCurrent | 0x0308 | +| * Measured5thHarmonicCurrent | 0x0309 | +| * Measured7thHarmonicCurrent | 0x030A | +| * Measured9thHarmonicCurrent | 0x030B | +| * Measured11thHarmonicCurrent | 0x030C | +| * MeasuredPhase1stHarmonicCurrent | 0x030D | +| * MeasuredPhase3rdHarmonicCurrent | 0x030E | +| * MeasuredPhase5thHarmonicCurrent | 0x030F | +| * MeasuredPhase7thHarmonicCurrent | 0x0310 | +| * MeasuredPhase9thHarmonicCurrent | 0x0311 | +| * MeasuredPhase11thHarmonicCurrent | 0x0312 | +| * AcFrequencyMultiplier | 0x0400 | +| * AcFrequencyDivisor | 0x0401 | +| * PowerMultiplier | 0x0402 | +| * PowerDivisor | 0x0403 | +| * HarmonicCurrentMultiplier | 0x0404 | +| * PhaseHarmonicCurrentMultiplier | 0x0405 | +| * InstantaneousVoltage | 0x0500 | +| * InstantaneousLineCurrent | 0x0501 | +| * InstantaneousActiveCurrent | 0x0502 | +| * InstantaneousReactiveCurrent | 0x0503 | +| * InstantaneousPower | 0x0504 | +| * RmsVoltage | 0x0505 | +| * RmsVoltageMin | 0x0506 | +| * RmsVoltageMax | 0x0507 | +| * RmsCurrent | 0x0508 | +| * RmsCurrentMin | 0x0509 | +| * RmsCurrentMax | 0x050A | +| * ActivePower | 0x050B | +| * ActivePowerMin | 0x050C | +| * ActivePowerMax | 0x050D | +| * ReactivePower | 0x050E | +| * ApparentPower | 0x050F | +| * PowerFactor | 0x0510 | +| * AverageRmsVoltageMeasurementPeriod | 0x0511 | +| * AverageRmsUnderVoltageCounter | 0x0513 | +| * RmsExtremeOverVoltagePeriod | 0x0514 | +| * RmsExtremeUnderVoltagePeriod | 0x0515 | +| * RmsVoltageSagPeriod | 0x0516 | +| * RmsVoltageSwellPeriod | 0x0517 | +| * AcVoltageMultiplier | 0x0600 | +| * AcVoltageDivisor | 0x0601 | +| * AcCurrentMultiplier | 0x0602 | +| * AcCurrentDivisor | 0x0603 | +| * AcPowerMultiplier | 0x0604 | +| * AcPowerDivisor | 0x0605 | +| * OverloadAlarmsMask | 0x0700 | +| * VoltageOverload | 0x0701 | +| * CurrentOverload | 0x0702 | +| * AcOverloadAlarmsMask | 0x0800 | +| * AcVoltageOverload | 0x0801 | +| * AcCurrentOverload | 0x0802 | +| * AcActivePowerOverload | 0x0803 | +| * AcReactivePowerOverload | 0x0804 | +| * AverageRmsOverVoltage | 0x0805 | +| * AverageRmsUnderVoltage | 0x0806 | +| * RmsExtremeOverVoltage | 0x0807 | +| * RmsExtremeUnderVoltage | 0x0808 | +| * RmsVoltageSag | 0x0809 | +| * RmsVoltageSwell | 0x080A | +| * LineCurrentPhaseB | 0x0901 | +| * ActiveCurrentPhaseB | 0x0902 | +| * ReactiveCurrentPhaseB | 0x0903 | +| * RmsVoltagePhaseB | 0x0905 | +| * RmsVoltageMinPhaseB | 0x0906 | +| * RmsVoltageMaxPhaseB | 0x0907 | +| * RmsCurrentPhaseB | 0x0908 | +| * RmsCurrentMinPhaseB | 0x0909 | +| * RmsCurrentMaxPhaseB | 0x090A | +| * ActivePowerPhaseB | 0x090B | +| * ActivePowerMinPhaseB | 0x090C | +| * ActivePowerMaxPhaseB | 0x090D | +| * ReactivePowerPhaseB | 0x090E | +| * ApparentPowerPhaseB | 0x090F | +| * PowerFactorPhaseB | 0x0910 | +| * AverageRmsVoltageMeasurementPeriodPhaseB | 0x0911 | +| * AverageRmsOverVoltageCounterPhaseB | 0x0912 | +| * AverageRmsUnderVoltageCounterPhaseB | 0x0913 | +| * RmsExtremeOverVoltagePeriodPhaseB | 0x0914 | +| * RmsExtremeUnderVoltagePeriodPhaseB | 0x0915 | +| * RmsVoltageSagPeriodPhaseB | 0x0916 | +| * RmsVoltageSwellPeriodPhaseB | 0x0917 | +| * LineCurrentPhaseC | 0x0A01 | +| * ActiveCurrentPhaseC | 0x0A02 | +| * ReactiveCurrentPhaseC | 0x0A03 | +| * RmsVoltagePhaseC | 0x0A05 | +| * RmsVoltageMinPhaseC | 0x0A06 | +| * RmsVoltageMaxPhaseC | 0x0A07 | +| * RmsCurrentPhaseC | 0x0A08 | +| * RmsCurrentMinPhaseC | 0x0A09 | +| * RmsCurrentMaxPhaseC | 0x0A0A | +| * ActivePowerPhaseC | 0x0A0B | +| * ActivePowerMinPhaseC | 0x0A0C | +| * ActivePowerMaxPhaseC | 0x0A0D | +| * ReactivePowerPhaseC | 0x0A0E | +| * ApparentPowerPhaseC | 0x0A0F | +| * PowerFactorPhaseC | 0x0A10 | +| * AverageRmsVoltageMeasurementPeriodPhaseC | 0x0A11 | +| * AverageRmsOverVoltageCounterPhaseC | 0x0A12 | +| * AverageRmsUnderVoltageCounterPhaseC | 0x0A13 | +| * RmsExtremeOverVoltagePeriodPhaseC | 0x0A14 | +| * RmsExtremeUnderVoltagePeriodPhaseC | 0x0A15 | +| * RmsVoltageSagPeriodPhaseC | 0x0A16 | +| * RmsVoltageSwellPeriodPhaseC | 0x0A17 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ /* - * Attribute AverageRmsUnderVoltage + * Command GetProfileInfoCommand */ -class ReadElectricalMeasurementAverageRmsUnderVoltage : public ReadAttribute { -public: - ReadElectricalMeasurementAverageRmsUnderVoltage() - : ReadAttribute("average-rms-under-voltage") - { - } - - ~ReadElectricalMeasurementAverageRmsUnderVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000806) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsUnderVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsUnderVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage : public SubscribeAttribute { +class ElectricalMeasurementGetProfileInfoCommand : public ClusterCommand { public: - SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage() - : SubscribeAttribute("average-rms-under-voltage") - { + ElectricalMeasurementGetProfileInfoCommand() + : ClusterCommand("get-profile-info-command") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000B04) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRElectricalMeasurementClusterGetProfileInfoCommandParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster getProfileInfoCommandWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000806) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsUnderVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +private: }; /* - * Attribute RmsExtremeOverVoltage + * Command GetMeasurementProfileCommand */ -class ReadElectricalMeasurementRmsExtremeOverVoltage : public ReadAttribute { -public: - ReadElectricalMeasurementRmsExtremeOverVoltage() - : ReadAttribute("rms-extreme-over-voltage") - { +class ElectricalMeasurementGetMeasurementProfileCommand + : public ClusterCommand { +public: + ElectricalMeasurementGetMeasurementProfileCommand() + : ClusterCommand("get-measurement-profile-command") { + AddArgument("AttributeId", 0, UINT16_MAX, &mRequest.attributeId); + AddArgument("StartTime", 0, UINT32_MAX, &mRequest.startTime); + AddArgument("NumberOfIntervals", 0, UINT8_MAX, &mRequest.numberOfIntervals); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0x00000B04) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams + alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.attributeId = + [NSNumber numberWithUnsignedShort:mRequest.attributeId]; + params.startTime = [NSNumber numberWithUnsignedInt:mRequest.startTime]; + params.numberOfIntervals = + [NSNumber numberWithUnsignedChar:mRequest.numberOfIntervals]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + getMeasurementProfileCommandWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } - ~ReadElectricalMeasurementRmsExtremeOverVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000807) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsExtremeOverVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeOverVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + chip::app::Clusters::ElectricalMeasurement::Commands:: + GetMeasurementProfileCommand::Type mRequest; }; -class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage : public SubscribeAttribute { +/* + * Attribute MeasurementType + */ +class ReadElectricalMeasurementMeasurementType : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage() - : SubscribeAttribute("rms-extreme-over-voltage") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000807) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsExtremeOverVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementMeasurementType() + : ReadAttribute("measurement-type") {} + + ~ReadElectricalMeasurementMeasurementType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasurementTypeWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasurementType response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement MeasurementType read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasurementType + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasurementType() + : SubscribeAttribute("measurement-type") {} + + ~SubscribeAttributeElectricalMeasurementMeasurementType() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasurementTypeWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasurementType response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeUnderVoltage + * Attribute DcVoltage */ -class ReadElectricalMeasurementRmsExtremeUnderVoltage : public ReadAttribute { +class ReadElectricalMeasurementDcVoltage : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeUnderVoltage() - : ReadAttribute("rms-extreme-under-voltage") - { - } - - ~ReadElectricalMeasurementRmsExtremeUnderVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000808) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsExtremeUnderVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltage response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeUnderVoltage read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcVoltage() : ReadAttribute("dc-voltage") {} + + ~ReadElectricalMeasurementDcVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000100) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcVoltageWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcVoltage read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcVoltage() + : SubscribeAttribute("dc-voltage") {} + + ~SubscribeAttributeElectricalMeasurementDcVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000100) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage : public SubscribeAttribute { +/* + * Attribute DcVoltageMin + */ +class ReadElectricalMeasurementDcVoltageMin : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage() - : SubscribeAttribute("rms-extreme-under-voltage") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000808) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsExtremeUnderVoltageWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltage response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcVoltageMin() : ReadAttribute("dc-voltage-min") {} + + ~ReadElectricalMeasurementDcVoltageMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000101) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcVoltageMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcVoltageMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcVoltageMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcVoltageMin() + : SubscribeAttribute("dc-voltage-min") {} + + ~SubscribeAttributeElectricalMeasurementDcVoltageMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000101) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcVoltageMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSag + * Attribute DcVoltageMax */ -class ReadElectricalMeasurementRmsVoltageSag : public ReadAttribute { +class ReadElectricalMeasurementDcVoltageMax : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageSag() - : ReadAttribute("rms-voltage-sag") - { - } - - ~ReadElectricalMeasurementRmsVoltageSag() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000809) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSagWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSag response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSag read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcVoltageMax() : ReadAttribute("dc-voltage-max") {} + + ~ReadElectricalMeasurementDcVoltageMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000102) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcVoltageMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcVoltageMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcVoltageMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcVoltageMax() + : SubscribeAttribute("dc-voltage-max") {} + + ~SubscribeAttributeElectricalMeasurementDcVoltageMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000102) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcVoltageMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSag : public SubscribeAttribute { +/* + * Attribute DcCurrent + */ +class ReadElectricalMeasurementDcCurrent : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSag() - : SubscribeAttribute("rms-voltage-sag") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageSag() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000809) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageSagWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSag response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcCurrent() : ReadAttribute("dc-current") {} + + ~ReadElectricalMeasurementDcCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000103) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcCurrentWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcCurrent() + : SubscribeAttribute("dc-current") {} + + ~SubscribeAttributeElectricalMeasurementDcCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000103) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSwell + * Attribute DcCurrentMin */ -class ReadElectricalMeasurementRmsVoltageSwell : public ReadAttribute { +class ReadElectricalMeasurementDcCurrentMin : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageSwell() - : ReadAttribute("rms-voltage-swell") - { - } - - ~ReadElectricalMeasurementRmsVoltageSwell() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000080A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSwellWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwell response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSwell read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcCurrentMin() : ReadAttribute("dc-current-min") {} + + ~ReadElectricalMeasurementDcCurrentMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000104) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcCurrentMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcCurrentMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcCurrentMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcCurrentMin() + : SubscribeAttribute("dc-current-min") {} + + ~SubscribeAttributeElectricalMeasurementDcCurrentMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000104) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcCurrentMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSwell : public SubscribeAttribute { +/* + * Attribute DcCurrentMax + */ +class ReadElectricalMeasurementDcCurrentMax : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSwell() - : SubscribeAttribute("rms-voltage-swell") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageSwell() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000080A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageSwellWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwell response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcCurrentMax() : ReadAttribute("dc-current-max") {} + + ~ReadElectricalMeasurementDcCurrentMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000105) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcCurrentMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcCurrentMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcCurrentMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcCurrentMax() + : SubscribeAttribute("dc-current-max") {} + + ~SubscribeAttributeElectricalMeasurementDcCurrentMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000105) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcCurrentMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute LineCurrentPhaseB + * Attribute DcPower */ -class ReadElectricalMeasurementLineCurrentPhaseB : public ReadAttribute { +class ReadElectricalMeasurementDcPower : public ReadAttribute { public: - ReadElectricalMeasurementLineCurrentPhaseB() - : ReadAttribute("line-current-phase-b") - { - } - - ~ReadElectricalMeasurementLineCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000901) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLineCurrentPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.LineCurrentPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement LineCurrentPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcPower() : ReadAttribute("dc-power") {} + + ~ReadElectricalMeasurementDcPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000106) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcPowerWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPower response %@", [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcPower read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcPower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcPower() + : SubscribeAttribute("dc-power") {} + + ~SubscribeAttributeElectricalMeasurementDcPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000106) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcPowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementLineCurrentPhaseB : public SubscribeAttribute { +/* + * Attribute DcPowerMin + */ +class ReadElectricalMeasurementDcPowerMin : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementLineCurrentPhaseB() - : SubscribeAttribute("line-current-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementLineCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000901) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeLineCurrentPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.LineCurrentPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcPowerMin() : ReadAttribute("dc-power-min") {} + + ~ReadElectricalMeasurementDcPowerMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000107) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcPowerMinWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcPowerMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcPowerMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcPowerMin() + : SubscribeAttribute("dc-power-min") {} + + ~SubscribeAttributeElectricalMeasurementDcPowerMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000107) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcPowerMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveCurrentPhaseB + * Attribute DcPowerMax */ -class ReadElectricalMeasurementActiveCurrentPhaseB : public ReadAttribute { +class ReadElectricalMeasurementDcPowerMax : public ReadAttribute { public: - ReadElectricalMeasurementActiveCurrentPhaseB() - : ReadAttribute("active-current-phase-b") - { - } - - ~ReadElectricalMeasurementActiveCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000902) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveCurrentPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActiveCurrentPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcPowerMax() : ReadAttribute("dc-power-max") {} + + ~ReadElectricalMeasurementDcPowerMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000108) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcPowerMaxWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcPowerMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcPowerMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcPowerMax() + : SubscribeAttribute("dc-power-max") {} + + ~SubscribeAttributeElectricalMeasurementDcPowerMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000108) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcPowerMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB : public SubscribeAttribute { +/* + * Attribute DcVoltageMultiplier + */ +class ReadElectricalMeasurementDcVoltageMultiplier : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB() - : SubscribeAttribute("active-current-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000902) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActiveCurrentPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcVoltageMultiplier() + : ReadAttribute("dc-voltage-multiplier") {} + + ~ReadElectricalMeasurementDcVoltageMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000200) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcVoltageMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcVoltageMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcVoltageMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcVoltageMultiplier() + : SubscribeAttribute("dc-voltage-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementDcVoltageMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000200) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcVoltageMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ReactiveCurrentPhaseB + * Attribute DcVoltageDivisor */ -class ReadElectricalMeasurementReactiveCurrentPhaseB : public ReadAttribute { +class ReadElectricalMeasurementDcVoltageDivisor : public ReadAttribute { public: - ReadElectricalMeasurementReactiveCurrentPhaseB() - : ReadAttribute("reactive-current-phase-b") - { - } - - ~ReadElectricalMeasurementReactiveCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000903) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReactiveCurrentPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ReactiveCurrentPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcVoltageDivisor() + : ReadAttribute("dc-voltage-divisor") {} + + ~ReadElectricalMeasurementDcVoltageDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000201) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcVoltageDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcVoltageDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcVoltageDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcVoltageDivisor() + : SubscribeAttribute("dc-voltage-divisor") {} + + ~SubscribeAttributeElectricalMeasurementDcVoltageDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000201) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcVoltageDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcVoltageDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB : public SubscribeAttribute { +/* + * Attribute DcCurrentMultiplier + */ +class ReadElectricalMeasurementDcCurrentMultiplier : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB() - : SubscribeAttribute("reactive-current-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000903) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeReactiveCurrentPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcCurrentMultiplier() + : ReadAttribute("dc-current-multiplier") {} + + ~ReadElectricalMeasurementDcCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000202) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcCurrentMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcCurrentMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcCurrentMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcCurrentMultiplier() + : SubscribeAttribute("dc-current-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementDcCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000202) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcCurrentMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltagePhaseB + * Attribute DcCurrentDivisor */ -class ReadElectricalMeasurementRmsVoltagePhaseB : public ReadAttribute { +class ReadElectricalMeasurementDcCurrentDivisor : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltagePhaseB() - : ReadAttribute("rms-voltage-phase-b") - { - } - - ~ReadElectricalMeasurementRmsVoltagePhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000905) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltagePhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltagePhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltagePhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcCurrentDivisor() + : ReadAttribute("dc-current-divisor") {} + + ~ReadElectricalMeasurementDcCurrentDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000203) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcCurrentDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcCurrentDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcCurrentDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcCurrentDivisor() + : SubscribeAttribute("dc-current-divisor") {} + + ~SubscribeAttributeElectricalMeasurementDcCurrentDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000203) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcCurrentDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcCurrentDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB() - : SubscribeAttribute("rms-voltage-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000905) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltagePhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltagePhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } +/* + * Attribute DcPowerMultiplier + */ +class ReadElectricalMeasurementDcPowerMultiplier : public ReadAttribute { +public: + ReadElectricalMeasurementDcPowerMultiplier() + : ReadAttribute("dc-power-multiplier") {} + + ~ReadElectricalMeasurementDcPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000204) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcPowerMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcPowerMultiplier read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcPowerMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcPowerMultiplier() + : SubscribeAttribute("dc-power-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementDcPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000204) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcPowerMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageMinPhaseB + * Attribute DcPowerDivisor */ -class ReadElectricalMeasurementRmsVoltageMinPhaseB : public ReadAttribute { +class ReadElectricalMeasurementDcPowerDivisor : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageMinPhaseB() - : ReadAttribute("rms-voltage-min-phase-b") - { - } - - ~ReadElectricalMeasurementRmsVoltageMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000906) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMinPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMinPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementDcPowerDivisor() + : ReadAttribute("dc-power-divisor") {} + + ~ReadElectricalMeasurementDcPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000205) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeDcPowerDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement DcPowerDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementDcPowerDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementDcPowerDivisor() + : SubscribeAttribute("dc-power-divisor") {} + + ~SubscribeAttributeElectricalMeasurementDcPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000205) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeDcPowerDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.DcPowerDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB : public SubscribeAttribute { +/* + * Attribute AcFrequency + */ +class ReadElectricalMeasurementAcFrequency : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB() - : SubscribeAttribute("rms-voltage-min-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000906) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageMinPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcFrequency() : ReadAttribute("ac-frequency") {} + + ~ReadElectricalMeasurementAcFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000300) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcFrequencyWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequency response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcFrequency read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcFrequency + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcFrequency() + : SubscribeAttribute("ac-frequency") {} + + ~SubscribeAttributeElectricalMeasurementAcFrequency() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000300) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcFrequencyWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequency response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageMaxPhaseB + * Attribute AcFrequencyMin */ -class ReadElectricalMeasurementRmsVoltageMaxPhaseB : public ReadAttribute { +class ReadElectricalMeasurementAcFrequencyMin : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageMaxPhaseB() - : ReadAttribute("rms-voltage-max-phase-b") - { - } - - ~ReadElectricalMeasurementRmsVoltageMaxPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000907) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMaxPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMaxPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcFrequencyMin() + : ReadAttribute("ac-frequency-min") {} + + ~ReadElectricalMeasurementAcFrequencyMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000301) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcFrequencyMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcFrequencyMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcFrequencyMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcFrequencyMin() + : SubscribeAttribute("ac-frequency-min") {} + + ~SubscribeAttributeElectricalMeasurementAcFrequencyMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000301) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcFrequencyMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB : public SubscribeAttribute { +/* + * Attribute AcFrequencyMax + */ +class ReadElectricalMeasurementAcFrequencyMax : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB() - : SubscribeAttribute("rms-voltage-max-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000907) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageMaxPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcFrequencyMax() + : ReadAttribute("ac-frequency-max") {} + + ~ReadElectricalMeasurementAcFrequencyMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000302) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcFrequencyMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcFrequencyMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcFrequencyMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcFrequencyMax() + : SubscribeAttribute("ac-frequency-max") {} + + ~SubscribeAttributeElectricalMeasurementAcFrequencyMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000302) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcFrequencyMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentPhaseB + * Attribute NeutralCurrent */ -class ReadElectricalMeasurementRmsCurrentPhaseB : public ReadAttribute { +class ReadElectricalMeasurementNeutralCurrent : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentPhaseB() - : ReadAttribute("rms-current-phase-b") - { - } - - ~ReadElectricalMeasurementRmsCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000908) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementNeutralCurrent() + : ReadAttribute("neutral-current") {} + + ~ReadElectricalMeasurementNeutralCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000303) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNeutralCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.NeutralCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement NeutralCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementNeutralCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementNeutralCurrent() + : SubscribeAttribute("neutral-current") {} + + ~SubscribeAttributeElectricalMeasurementNeutralCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000303) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNeutralCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.NeutralCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB : public SubscribeAttribute { +/* + * Attribute TotalActivePower + */ +class ReadElectricalMeasurementTotalActivePower : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB() - : SubscribeAttribute("rms-current-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000908) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementTotalActivePower() + : ReadAttribute("total-active-power") {} + + ~ReadElectricalMeasurementTotalActivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000304) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTotalActivePowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalActivePower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement TotalActivePower read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementTotalActivePower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementTotalActivePower() + : SubscribeAttribute("total-active-power") {} + + ~SubscribeAttributeElectricalMeasurementTotalActivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000304) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTotalActivePowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalActivePower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentMinPhaseB + * Attribute TotalReactivePower */ -class ReadElectricalMeasurementRmsCurrentMinPhaseB : public ReadAttribute { +class ReadElectricalMeasurementTotalReactivePower : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentMinPhaseB() - : ReadAttribute("rms-current-min-phase-b") - { - } - - ~ReadElectricalMeasurementRmsCurrentMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000909) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMinPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMinPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementTotalReactivePower() + : ReadAttribute("total-reactive-power") {} + + ~ReadElectricalMeasurementTotalReactivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000305) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTotalReactivePowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalReactivePower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement TotalReactivePower read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementTotalReactivePower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementTotalReactivePower() + : SubscribeAttribute("total-reactive-power") {} + + ~SubscribeAttributeElectricalMeasurementTotalReactivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000305) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTotalReactivePowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalReactivePower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB : public SubscribeAttribute { +/* + * Attribute TotalApparentPower + */ +class ReadElectricalMeasurementTotalApparentPower : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB() - : SubscribeAttribute("rms-current-min-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000909) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentMinPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementTotalApparentPower() + : ReadAttribute("total-apparent-power") {} + + ~ReadElectricalMeasurementTotalApparentPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000306) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTotalApparentPowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalApparentPower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement TotalApparentPower read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementTotalApparentPower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementTotalApparentPower() + : SubscribeAttribute("total-apparent-power") {} + + ~SubscribeAttributeElectricalMeasurementTotalApparentPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000306) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTotalApparentPowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.TotalApparentPower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentMaxPhaseB + * Attribute Measured1stHarmonicCurrent */ -class ReadElectricalMeasurementRmsCurrentMaxPhaseB : public ReadAttribute { -public: - ReadElectricalMeasurementRmsCurrentMaxPhaseB() - : ReadAttribute("rms-current-max-phase-b") - { - } - - ~ReadElectricalMeasurementRmsCurrentMaxPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMaxPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMaxPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class ReadElectricalMeasurementMeasured1stHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured1stHarmonicCurrent() + : ReadAttribute("measured1st-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured1stHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000307) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured1stHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured1stHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured1stHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent() + : SubscribeAttribute("measured1st-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000307) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured1stHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured1stHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB() - : SubscribeAttribute("rms-current-max-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB() {} +/* + * Attribute Measured3rdHarmonicCurrent + */ +class ReadElectricalMeasurementMeasured3rdHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured3rdHarmonicCurrent() + : ReadAttribute("measured3rd-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured3rdHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000308) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured3rdHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured3rdHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured3rdHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent() + : SubscribeAttribute("measured3rd-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000308) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured3rdHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured3rdHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentMaxPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute Measured5thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasured5thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured5thHarmonicCurrent() + : ReadAttribute("measured5th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured5thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000309) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured5thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured5thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured5thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent() + : SubscribeAttribute("measured5th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000309) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured5thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured5thHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute Measured7thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasured7thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured7thHarmonicCurrent() + : ReadAttribute("measured7th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured7thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured7thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured7thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured7thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent() + : SubscribeAttribute("measured7th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured7thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured7thHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerPhaseB + * Attribute Measured9thHarmonicCurrent */ -class ReadElectricalMeasurementActivePowerPhaseB : public ReadAttribute { -public: - ReadElectricalMeasurementActivePowerPhaseB() - : ReadAttribute("active-power-phase-b") - { - } +class ReadElectricalMeasurementMeasured9thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured9thHarmonicCurrent() + : ReadAttribute("measured9th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured9thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured9thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured9thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured9thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent() + : SubscribeAttribute("measured9th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured9thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured9thHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementActivePowerPhaseB() {} +/* + * Attribute Measured11thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasured11thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasured11thHarmonicCurrent() + : ReadAttribute("measured11th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasured11thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasured11thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.Measured11thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement Measured11thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent() + : SubscribeAttribute("measured11th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasured11thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.Measured11thHarmonicCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090B) on endpoint %u", endpointId); +/* + * Attribute MeasuredPhase1stHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent() + : ReadAttribute("measured-phase1st-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase1stHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase1stHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase1stHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent() + : SubscribeAttribute("measured-phase1st-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase1stHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase1stHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredPhase3rdHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() + : ReadAttribute("measured-phase3rd-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase3rdHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase3rdHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase3rdHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() + : SubscribeAttribute("measured-phase3rd-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase3rdHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase3rdHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerPhaseB : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementActivePowerPhaseB() - : SubscribeAttribute("active-power-phase-b") - { - } +/* + * Attribute MeasuredPhase5thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent() + : ReadAttribute("measured-phase5th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000030F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase5thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase5thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase5thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent() + : SubscribeAttribute("measured-phase5th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000030F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase5thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase5thHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementActivePowerPhaseB() {} +/* + * Attribute MeasuredPhase7thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent() + : ReadAttribute("measured-phase7th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000310) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase7thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase7thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase7thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent() + : SubscribeAttribute("measured-phase7th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000310) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase7thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase7thHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute MeasuredPhase9thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent() + : ReadAttribute("measured-phase9th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000311) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase9thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase9thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase9thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent() + : SubscribeAttribute("measured-phase9th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000311) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase9thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase9thHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute MeasuredPhase11thHarmonicCurrent + */ +class ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent() + : ReadAttribute("measured-phase11th-harmonic-current") {} + + ~ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000312) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeMeasuredPhase11thHarmonicCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.MeasuredPhase11thHarmonicCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement MeasuredPhase11thHarmonicCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent() + : SubscribeAttribute("measured-phase11th-harmonic-current") {} + + ~SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000312) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMeasuredPhase11thHarmonicCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.MeasuredPhase11thHarmonicCurrent " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerMinPhaseB + * Attribute AcFrequencyMultiplier */ -class ReadElectricalMeasurementActivePowerMinPhaseB : public ReadAttribute { +class ReadElectricalMeasurementAcFrequencyMultiplier : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerMinPhaseB() - : ReadAttribute("active-power-min-phase-b") - { - } - - ~ReadElectricalMeasurementActivePowerMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMinPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMinPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcFrequencyMultiplier() + : ReadAttribute("ac-frequency-multiplier") {} + + ~ReadElectricalMeasurementAcFrequencyMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000400) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcFrequencyMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcFrequencyMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier() + : SubscribeAttribute("ac-frequency-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000400) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcFrequencyMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB : public SubscribeAttribute { +/* + * Attribute AcFrequencyDivisor + */ +class ReadElectricalMeasurementAcFrequencyDivisor : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB() - : SubscribeAttribute("active-power-min-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerMinPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcFrequencyDivisor() + : ReadAttribute("ac-frequency-divisor") {} + + ~ReadElectricalMeasurementAcFrequencyDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000401) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcFrequencyDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcFrequencyDivisor read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcFrequencyDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcFrequencyDivisor() + : SubscribeAttribute("ac-frequency-divisor") {} + + ~SubscribeAttributeElectricalMeasurementAcFrequencyDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000401) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcFrequencyDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcFrequencyDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerMaxPhaseB + * Attribute PowerMultiplier */ -class ReadElectricalMeasurementActivePowerMaxPhaseB : public ReadAttribute { +class ReadElectricalMeasurementPowerMultiplier : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerMaxPhaseB() - : ReadAttribute("active-power-max-phase-b") - { - } - - ~ReadElectricalMeasurementActivePowerMaxPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMaxPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMaxPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementPowerMultiplier() + : ReadAttribute("power-multiplier") {} + + ~ReadElectricalMeasurementPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000402) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement PowerMultiplier read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPowerMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPowerMultiplier() + : SubscribeAttribute("power-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000402) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB : public SubscribeAttribute { +/* + * Attribute PowerDivisor + */ +class ReadElectricalMeasurementPowerDivisor : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB() - : SubscribeAttribute("active-power-max-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB() {} + ReadElectricalMeasurementPowerDivisor() : ReadAttribute("power-divisor") {} + + ~ReadElectricalMeasurementPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000403) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement PowerDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPowerDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPowerDivisor() + : SubscribeAttribute("power-divisor") {} + + ~SubscribeAttributeElectricalMeasurementPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000403) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerMaxPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute HarmonicCurrentMultiplier + */ +class ReadElectricalMeasurementHarmonicCurrentMultiplier + : public ReadAttribute { +public: + ReadElectricalMeasurementHarmonicCurrentMultiplier() + : ReadAttribute("harmonic-current-multiplier") {} + + ~ReadElectricalMeasurementHarmonicCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000404) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeHarmonicCurrentMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.HarmonicCurrentMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement HarmonicCurrentMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier() + : SubscribeAttribute("harmonic-current-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000404) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHarmonicCurrentMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.HarmonicCurrentMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute PhaseHarmonicCurrentMultiplier + */ +class ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier + : public ReadAttribute { +public: + ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier() + : ReadAttribute("phase-harmonic-current-multiplier") {} + + ~ReadElectricalMeasurementPhaseHarmonicCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000405) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePhaseHarmonicCurrentMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PhaseHarmonicCurrentMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement PhaseHarmonicCurrentMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier() + : SubscribeAttribute("phase-harmonic-current-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000405) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePhaseHarmonicCurrentMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PhaseHarmonicCurrentMultiplier " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ReactivePowerPhaseB + * Attribute InstantaneousVoltage */ -class ReadElectricalMeasurementReactivePowerPhaseB : public ReadAttribute { +class ReadElectricalMeasurementInstantaneousVoltage : public ReadAttribute { public: - ReadElectricalMeasurementReactivePowerPhaseB() - : ReadAttribute("reactive-power-phase-b") - { - } - - ~ReadElectricalMeasurementReactivePowerPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReactivePowerPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePowerPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ReactivePowerPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementInstantaneousVoltage() + : ReadAttribute("instantaneous-voltage") {} + + ~ReadElectricalMeasurementInstantaneousVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000500) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstantaneousVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement InstantaneousVoltage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementInstantaneousVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementInstantaneousVoltage() + : SubscribeAttribute("instantaneous-voltage") {} + + ~SubscribeAttributeElectricalMeasurementInstantaneousVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000500) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstantaneousVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementReactivePowerPhaseB : public SubscribeAttribute { +/* + * Attribute InstantaneousLineCurrent + */ +class ReadElectricalMeasurementInstantaneousLineCurrent : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementReactivePowerPhaseB() - : SubscribeAttribute("reactive-power-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementReactivePowerPhaseB() {} + ReadElectricalMeasurementInstantaneousLineCurrent() + : ReadAttribute("instantaneous-line-current") {} + + ~ReadElectricalMeasurementInstantaneousLineCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000501) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstantaneousLineCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousLineCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement InstantaneousLineCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent() + : SubscribeAttribute("instantaneous-line-current") {} + + ~SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000501) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstantaneousLineCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousLineCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeReactivePowerPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePowerPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute InstantaneousActiveCurrent + */ +class ReadElectricalMeasurementInstantaneousActiveCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementInstantaneousActiveCurrent() + : ReadAttribute("instantaneous-active-current") {} + + ~ReadElectricalMeasurementInstantaneousActiveCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000502) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstantaneousActiveCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousActiveCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement InstantaneousActiveCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent() + : SubscribeAttribute("instantaneous-active-current") {} + + ~SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000502) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstantaneousActiveCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousActiveCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute InstantaneousReactiveCurrent + */ +class ReadElectricalMeasurementInstantaneousReactiveCurrent + : public ReadAttribute { +public: + ReadElectricalMeasurementInstantaneousReactiveCurrent() + : ReadAttribute("instantaneous-reactive-current") {} + + ~ReadElectricalMeasurementInstantaneousReactiveCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000503) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstantaneousReactiveCurrentWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousReactiveCurrent response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement InstantaneousReactiveCurrent read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent() + : SubscribeAttribute("instantaneous-reactive-current") {} + + ~SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000503) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstantaneousReactiveCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.InstantaneousReactiveCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ApparentPowerPhaseB + * Attribute InstantaneousPower */ -class ReadElectricalMeasurementApparentPowerPhaseB : public ReadAttribute { +class ReadElectricalMeasurementInstantaneousPower : public ReadAttribute { public: - ReadElectricalMeasurementApparentPowerPhaseB() - : ReadAttribute("apparent-power-phase-b") - { - } - - ~ReadElectricalMeasurementApparentPowerPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000090F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApparentPowerPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPowerPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ApparentPowerPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementInstantaneousPower() + : ReadAttribute("instantaneous-power") {} + + ~ReadElectricalMeasurementInstantaneousPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000504) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInstantaneousPowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousPower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement InstantaneousPower read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementInstantaneousPower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementInstantaneousPower() + : SubscribeAttribute("instantaneous-power") {} + + ~SubscribeAttributeElectricalMeasurementInstantaneousPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000504) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInstantaneousPowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.InstantaneousPower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementApparentPowerPhaseB : public SubscribeAttribute { +/* + * Attribute RmsVoltage + */ +class ReadElectricalMeasurementRmsVoltage : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementApparentPowerPhaseB() - : SubscribeAttribute("apparent-power-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementApparentPowerPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000090F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApparentPowerPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPowerPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltage() : ReadAttribute("rms-voltage") {} + + ~ReadElectricalMeasurementRmsVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000505) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltage read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltage() + : SubscribeAttribute("rms-voltage") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000505) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PowerFactorPhaseB + * Attribute RmsVoltageMin */ -class ReadElectricalMeasurementPowerFactorPhaseB : public ReadAttribute { +class ReadElectricalMeasurementRmsVoltageMin : public ReadAttribute { public: - ReadElectricalMeasurementPowerFactorPhaseB() - : ReadAttribute("power-factor-phase-b") - { - } - - ~ReadElectricalMeasurementPowerFactorPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000910) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerFactorPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactorPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PowerFactorPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltageMin() : ReadAttribute("rms-voltage-min") {} + + ~ReadElectricalMeasurementRmsVoltageMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000506) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMin() + : SubscribeAttribute("rms-voltage-min") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000506) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPowerFactorPhaseB : public SubscribeAttribute { +/* + * Attribute RmsVoltageMax + */ +class ReadElectricalMeasurementRmsVoltageMax : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementPowerFactorPhaseB() - : SubscribeAttribute("power-factor-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementPowerFactorPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000910) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePowerFactorPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactorPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltageMax() : ReadAttribute("rms-voltage-max") {} + + ~ReadElectricalMeasurementRmsVoltageMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000507) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMax() + : SubscribeAttribute("rms-voltage-max") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000507) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsVoltageMeasurementPeriodPhaseB + * Attribute RmsCurrent */ -class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB : public ReadAttribute { +class ReadElectricalMeasurementRmsCurrent : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() - : ReadAttribute("average-rms-voltage-measurement-period-phase-b") - { - } - - ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000911) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriodPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsVoltageMeasurementPeriodPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrent() : ReadAttribute("rms-current") {} + + ~ReadElectricalMeasurementRmsCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000508) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrent response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrent read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrent + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrent() + : SubscribeAttribute("rms-current") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrent() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000508) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrent response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB : public SubscribeAttribute { +/* + * Attribute RmsCurrentMin + */ +class ReadElectricalMeasurementRmsCurrentMin : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() - : SubscribeAttribute("average-rms-voltage-measurement-period-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000911) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriodPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMin() : ReadAttribute("rms-current-min") {} + + ~ReadElectricalMeasurementRmsCurrentMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000509) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMin() + : SubscribeAttribute("rms-current-min") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000509) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsOverVoltageCounterPhaseB + * Attribute RmsCurrentMax */ -class ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB : public ReadAttribute { +class ReadElectricalMeasurementRmsCurrentMax : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() - : ReadAttribute("average-rms-over-voltage-counter-phase-b") - { - } - - ~ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000912) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeAverageRmsOverVoltageCounterPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsOverVoltageCounterPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMax() : ReadAttribute("rms-current-max") {} + + ~ReadElectricalMeasurementRmsCurrentMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMax() + : SubscribeAttribute("rms-current-max") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB : public SubscribeAttribute { +/* + * Attribute ActivePower + */ +class ReadElectricalMeasurementActivePower : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() - : SubscribeAttribute("average-rms-over-voltage-counter-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000912) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsOverVoltageCounterPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePower() : ReadAttribute("active-power") {} + + ~ReadElectricalMeasurementActivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePower read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePower() + : SubscribeAttribute("active-power") {} + + ~SubscribeAttributeElectricalMeasurementActivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsUnderVoltageCounterPhaseB + * Attribute ActivePowerMin */ -class ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB : public ReadAttribute { +class ReadElectricalMeasurementActivePowerMin : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() - : ReadAttribute("average-rms-under-voltage-counter-phase-b") - { - } - - ~ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000913) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsUnderVoltageCounterPhaseBWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsUnderVoltageCounterPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerMin() + : ReadAttribute("active-power-min") {} + + ~ReadElectricalMeasurementActivePowerMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMinWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMin response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMin read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMin + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMin() + : SubscribeAttribute("active-power-min") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMin() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMinWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMin response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB : public SubscribeAttribute { +/* + * Attribute ActivePowerMax + */ +class ReadElectricalMeasurementActivePowerMax : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() - : SubscribeAttribute("average-rms-under-voltage-counter-phase-b") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000913) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsUnderVoltageCounterPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; + ReadElectricalMeasurementActivePowerMax() + : ReadAttribute("active-power-max") {} + + ~ReadElectricalMeasurementActivePowerMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMaxWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMax response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMax read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMax + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMax() + : SubscribeAttribute("active-power-max") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMax() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMaxWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMax response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ReactivePower + */ +class ReadElectricalMeasurementReactivePower : public ReadAttribute { +public: + ReadElectricalMeasurementReactivePower() : ReadAttribute("reactive-power") {} + + ~ReadElectricalMeasurementReactivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReactivePowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ReactivePower read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementReactivePower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementReactivePower() + : SubscribeAttribute("reactive-power") {} + + ~SubscribeAttributeElectricalMeasurementReactivePower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReactivePowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeOverVoltagePeriodPhaseB + * Attribute ApparentPower */ -class ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB : public ReadAttribute { +class ReadElectricalMeasurementApparentPower : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() - : ReadAttribute("rms-extreme-over-voltage-period-phase-b") - { - } + ReadElectricalMeasurementApparentPower() : ReadAttribute("apparent-power") {} + + ~ReadElectricalMeasurementApparentPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000050F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApparentPowerWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPower response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ApparentPower read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementApparentPower + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementApparentPower() + : SubscribeAttribute("apparent-power") {} + + ~SubscribeAttributeElectricalMeasurementApparentPower() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000050F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApparentPowerWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPower response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() {} +/* + * Attribute PowerFactor + */ +class ReadElectricalMeasurementPowerFactor : public ReadAttribute { +public: + ReadElectricalMeasurementPowerFactor() : ReadAttribute("power-factor") {} + + ~ReadElectricalMeasurementPowerFactor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000510) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerFactorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement PowerFactor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPowerFactor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPowerFactor() + : SubscribeAttribute("power-factor") {} + + ~SubscribeAttributeElectricalMeasurementPowerFactor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000510) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerFactorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000914) on endpoint %u", endpointId); +/* + * Attribute AverageRmsVoltageMeasurementPeriod + */ +class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod() + : ReadAttribute("average-rms-voltage-measurement-period") {} + + ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000511) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsVoltageMeasurementPeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriod " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsVoltageMeasurementPeriod " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod + : public WriteAttribute { +public: + WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod() + : WriteAttribute("average-rms-voltage-measurement-period") { + AddArgument("attr-name", "average-rms-voltage-measurement-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000511) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeAverageRmsVoltageMeasurementPeriodWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "ElectricalMeasu" + "rement " + "AverageRmsVolta" + "geMeasurementPe" + "riod write " + "Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeRmsExtremeOverVoltagePeriodPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeOverVoltagePeriodPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() - : SubscribeAttribute("rms-extreme-over-voltage-period-phase-b") - { - } + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod() + : SubscribeAttribute("average-rms-voltage-measurement-period") {} - ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() {} + ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod() { + } - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000914) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000511) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsVoltageMeasurementPeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsExtremeOverVoltagePeriodPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriod " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeUnderVoltagePeriodPhaseB + * Attribute AverageRmsUnderVoltageCounter */ -class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB : public ReadAttribute { -public: - ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() - : ReadAttribute("rms-extreme-under-voltage-period-phase-b") - { - } - - ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000915) on endpoint %u", endpointId); +class ReadElectricalMeasurementAverageRmsUnderVoltageCounter + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsUnderVoltageCounter() + : ReadAttribute("average-rms-under-voltage-counter") {} + + ~ReadElectricalMeasurementAverageRmsUnderVoltageCounter() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000513) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsUnderVoltageCounterWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounter response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement AverageRmsUnderVoltageCounter read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteElectricalMeasurementAverageRmsUnderVoltageCounter + : public WriteAttribute { +public: + WriteElectricalMeasurementAverageRmsUnderVoltageCounter() + : WriteAttribute("average-rms-under-voltage-counter") { + AddArgument("attr-name", "average-rms-under-voltage-counter"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementAverageRmsUnderVoltageCounter() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000513) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeAverageRmsUnderVoltageCounterWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "ElectricalMeasuremen" + "t " + "AverageRmsUnderVolta" + "geCounter write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeRmsExtremeUnderVoltagePeriodPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeUnderVoltagePeriodPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() - : SubscribeAttribute("rms-extreme-under-voltage-period-phase-b") - { - } + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter() + : SubscribeAttribute("average-rms-under-voltage-counter") {} - ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() {} + ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000915) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000513) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAverageRmsUnderVoltageCounterWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounter response " + @"%@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSagPeriodPhaseB + * Attribute RmsExtremeOverVoltagePeriod */ -class ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB : public ReadAttribute { -public: - ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB() - : ReadAttribute("rms-voltage-sag-period-phase-b") - { - } - - ~ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000916) on endpoint %u", endpointId); +class ReadElectricalMeasurementRmsExtremeOverVoltagePeriod + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeOverVoltagePeriod() + : ReadAttribute("rms-extreme-over-voltage-period") {} + + ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000514) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeOverVoltagePeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriod response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement RmsExtremeOverVoltagePeriod read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteElectricalMeasurementRmsExtremeOverVoltagePeriod + : public WriteAttribute { +public: + WriteElectricalMeasurementRmsExtremeOverVoltagePeriod() + : WriteAttribute("rms-extreme-over-voltage-period") { + AddArgument("attr-name", "rms-extreme-over-voltage-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementRmsExtremeOverVoltagePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000514) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeRmsExtremeOverVoltagePeriodWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ElectricalMeasurement " + "RmsExtremeOverVoltageP" + "eriod write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSagPeriodPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSagPeriodPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB() - : SubscribeAttribute("rms-voltage-sag-period-phase-b") - { - } + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod() + : SubscribeAttribute("rms-extreme-over-voltage-period") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB() {} + ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000916) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000514) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsExtremeOverVoltagePeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageSagPeriodPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.RmsExtremeOverVoltagePeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSwellPeriodPhaseB + * Attribute RmsExtremeUnderVoltagePeriod */ -class ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB : public ReadAttribute { -public: - ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB() - : ReadAttribute("rms-voltage-swell-period-phase-b") - { - } - - ~ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000917) on endpoint %u", endpointId); +class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod() + : ReadAttribute("rms-extreme-under-voltage-period") {} + + ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000515) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeUnderVoltagePeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriod response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement RmsExtremeUnderVoltagePeriod read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod + : public WriteAttribute { +public: + WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod() + : WriteAttribute("rms-extreme-under-voltage-period") { + AddArgument("attr-name", "rms-extreme-under-voltage-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000515) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeRmsExtremeUnderVoltagePeriodWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ElectricalMeasurement" + " RmsExtremeUnderVolta" + "gePeriod write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSwellPeriodPhaseBWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseB response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSwellPeriodPhaseB read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB() - : SubscribeAttribute("rms-voltage-swell-period-phase-b") - { - } + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod() + : SubscribeAttribute("rms-extreme-under-voltage-period") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB() {} + ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000917) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000515) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsExtremeUnderVoltagePeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageSwellPeriodPhaseBWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseB response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.RmsExtremeUnderVoltagePeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute LineCurrentPhaseC + * Attribute RmsVoltageSagPeriod */ -class ReadElectricalMeasurementLineCurrentPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsVoltageSagPeriod : public ReadAttribute { public: - ReadElectricalMeasurementLineCurrentPhaseC() - : ReadAttribute("line-current-phase-c") - { - } - - ~ReadElectricalMeasurementLineCurrentPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A01) on endpoint %u", endpointId); + ReadElectricalMeasurementRmsVoltageSagPeriod() + : ReadAttribute("rms-voltage-sag-period") {} + + ~ReadElectricalMeasurementRmsVoltageSagPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000516) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSagPeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriod response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSagPeriod read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLineCurrentPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.LineCurrentPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement LineCurrentPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +class WriteElectricalMeasurementRmsVoltageSagPeriod : public WriteAttribute { +public: + WriteElectricalMeasurementRmsVoltageSagPeriod() + : WriteAttribute("rms-voltage-sag-period") { + AddArgument("attr-name", "rms-voltage-sag-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementRmsVoltageSagPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000516) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeRmsVoltageSagPeriodWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("ElectricalMeasurement " + "RmsVoltageSagPeriod " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementLineCurrentPhaseC : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementLineCurrentPhaseC() - : SubscribeAttribute("line-current-phase-c") - { - } + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod() + : SubscribeAttribute("rms-voltage-sag-period") {} - ~SubscribeAttributeElectricalMeasurementLineCurrentPhaseC() {} + ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A01) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000516) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSagPeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLineCurrentPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.LineCurrentPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ActiveCurrentPhaseC + * Attribute RmsVoltageSwellPeriod */ -class ReadElectricalMeasurementActiveCurrentPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsVoltageSwellPeriod : public ReadAttribute { public: - ReadElectricalMeasurementActiveCurrentPhaseC() - : ReadAttribute("active-current-phase-c") - { - } - - ~ReadElectricalMeasurementActiveCurrentPhaseC() {} + ReadElectricalMeasurementRmsVoltageSwellPeriod() + : ReadAttribute("rms-voltage-swell-period") {} + + ~ReadElectricalMeasurementRmsVoltageSwellPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000517) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSwellPeriodWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriod response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSwellPeriod read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A02) on endpoint %u", endpointId); +class WriteElectricalMeasurementRmsVoltageSwellPeriod : public WriteAttribute { +public: + WriteElectricalMeasurementRmsVoltageSwellPeriod() + : WriteAttribute("rms-voltage-swell-period") { + AddArgument("attr-name", "rms-voltage-swell-period"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementRmsVoltageSwellPeriod() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000517) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeRmsVoltageSwellPeriodWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ElectricalMeasurement" + " RmsVoltageSwellPerio" + "d write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActiveCurrentPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActiveCurrentPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC() - : SubscribeAttribute("active-current-phase-c") - { - } + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod() + : SubscribeAttribute("rms-voltage-swell-period") {} - ~SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC() {} + ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A02) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000517) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSwellPeriodWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeActiveCurrentPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriod response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute ReactiveCurrentPhaseC + * Attribute AcVoltageMultiplier */ -class ReadElectricalMeasurementReactiveCurrentPhaseC : public ReadAttribute { +class ReadElectricalMeasurementAcVoltageMultiplier : public ReadAttribute { public: - ReadElectricalMeasurementReactiveCurrentPhaseC() - : ReadAttribute("reactive-current-phase-c") - { - } - - ~ReadElectricalMeasurementReactiveCurrentPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A03) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReactiveCurrentPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ReactiveCurrentPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcVoltageMultiplier() + : ReadAttribute("ac-voltage-multiplier") {} + + ~ReadElectricalMeasurementAcVoltageMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000600) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcVoltageMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcVoltageMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcVoltageMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcVoltageMultiplier() + : SubscribeAttribute("ac-voltage-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementAcVoltageMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000600) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcVoltageMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC : public SubscribeAttribute { +/* + * Attribute AcVoltageDivisor + */ +class ReadElectricalMeasurementAcVoltageDivisor : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC() - : SubscribeAttribute("reactive-current-phase-c") - { - } + ReadElectricalMeasurementAcVoltageDivisor() + : ReadAttribute("ac-voltage-divisor") {} + + ~ReadElectricalMeasurementAcVoltageDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000601) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcVoltageDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcVoltageDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcVoltageDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcVoltageDivisor() + : SubscribeAttribute("ac-voltage-divisor") {} + + ~SubscribeAttributeElectricalMeasurementAcVoltageDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000601) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcVoltageDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC() {} +/* + * Attribute AcCurrentMultiplier + */ +class ReadElectricalMeasurementAcCurrentMultiplier : public ReadAttribute { +public: + ReadElectricalMeasurementAcCurrentMultiplier() + : ReadAttribute("ac-current-multiplier") {} + + ~ReadElectricalMeasurementAcCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000602) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcCurrentMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcCurrentMultiplier read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcCurrentMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcCurrentMultiplier() + : SubscribeAttribute("ac-current-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementAcCurrentMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000602) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcCurrentMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A03) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeReactiveCurrentPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute AcCurrentDivisor + */ +class ReadElectricalMeasurementAcCurrentDivisor : public ReadAttribute { +public: + ReadElectricalMeasurementAcCurrentDivisor() + : ReadAttribute("ac-current-divisor") {} + + ~ReadElectricalMeasurementAcCurrentDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000603) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcCurrentDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcCurrentDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcCurrentDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcCurrentDivisor() + : SubscribeAttribute("ac-current-divisor") {} + + ~SubscribeAttributeElectricalMeasurementAcCurrentDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000603) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcCurrentDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute AcPowerMultiplier + */ +class ReadElectricalMeasurementAcPowerMultiplier : public ReadAttribute { +public: + ReadElectricalMeasurementAcPowerMultiplier() + : ReadAttribute("ac-power-multiplier") {} + + ~ReadElectricalMeasurementAcPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000604) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcPowerMultiplierWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcPowerMultiplier response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcPowerMultiplier read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcPowerMultiplier + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcPowerMultiplier() + : SubscribeAttribute("ac-power-multiplier") {} + + ~SubscribeAttributeElectricalMeasurementAcPowerMultiplier() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000604) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcPowerMultiplierWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcPowerMultiplier response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltagePhaseC + * Attribute AcPowerDivisor */ -class ReadElectricalMeasurementRmsVoltagePhaseC : public ReadAttribute { +class ReadElectricalMeasurementAcPowerDivisor : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltagePhaseC() - : ReadAttribute("rms-voltage-phase-c") - { - } + ReadElectricalMeasurementAcPowerDivisor() + : ReadAttribute("ac-power-divisor") {} + + ~ReadElectricalMeasurementAcPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000605) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcPowerDivisorWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcPowerDivisor response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcPowerDivisor read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcPowerDivisor + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcPowerDivisor() + : SubscribeAttribute("ac-power-divisor") {} + + ~SubscribeAttributeElectricalMeasurementAcPowerDivisor() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000605) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcPowerDivisorWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcPowerDivisor response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementRmsVoltagePhaseC() {} +/* + * Attribute OverloadAlarmsMask + */ +class ReadElectricalMeasurementOverloadAlarmsMask : public ReadAttribute { +public: + ReadElectricalMeasurementOverloadAlarmsMask() + : ReadAttribute("overload-alarms-mask") {} + + ~ReadElectricalMeasurementOverloadAlarmsMask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000700) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOverloadAlarmsMaskWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.OverloadAlarmsMask response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement OverloadAlarmsMask read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A05) on endpoint %u", endpointId); +class WriteElectricalMeasurementOverloadAlarmsMask : public WriteAttribute { +public: + WriteElectricalMeasurementOverloadAlarmsMask() + : WriteAttribute("overload-alarms-mask") { + AddArgument("attr-name", "overload-alarms-mask"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementOverloadAlarmsMask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000700) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeOverloadAlarmsMaskWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "ElectricalMeasurement " + "OverloadAlarmsMask write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltagePhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltagePhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltagePhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint8_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementOverloadAlarmsMask + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC() - : SubscribeAttribute("rms-voltage-phase-c") - { - } + SubscribeAttributeElectricalMeasurementOverloadAlarmsMask() + : SubscribeAttribute("overload-alarms-mask") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC() {} + ~SubscribeAttributeElectricalMeasurementOverloadAlarmsMask() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A05) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000700) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOverloadAlarmsMaskWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltagePhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltagePhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.OverloadAlarmsMask response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageMinPhaseC + * Attribute VoltageOverload */ -class ReadElectricalMeasurementRmsVoltageMinPhaseC : public ReadAttribute { +class ReadElectricalMeasurementVoltageOverload : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageMinPhaseC() - : ReadAttribute("rms-voltage-min-phase-c") - { - } - - ~ReadElectricalMeasurementRmsVoltageMinPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A06) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMinPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMinPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementVoltageOverload() + : ReadAttribute("voltage-overload") {} + + ~ReadElectricalMeasurementVoltageOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000701) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVoltageOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.VoltageOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement VoltageOverload read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementVoltageOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementVoltageOverload() + : SubscribeAttribute("voltage-overload") {} + + ~SubscribeAttributeElectricalMeasurementVoltageOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000701) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVoltageOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.VoltageOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC : public SubscribeAttribute { +/* + * Attribute CurrentOverload + */ +class ReadElectricalMeasurementCurrentOverload : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC() - : SubscribeAttribute("rms-voltage-min-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A06) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageMinPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementCurrentOverload() + : ReadAttribute("current-overload") {} + + ~ReadElectricalMeasurementCurrentOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000702) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCurrentOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.CurrentOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement CurrentOverload read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementCurrentOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementCurrentOverload() + : SubscribeAttribute("current-overload") {} + + ~SubscribeAttributeElectricalMeasurementCurrentOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000702) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.CurrentOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageMaxPhaseC + * Attribute AcOverloadAlarmsMask */ -class ReadElectricalMeasurementRmsVoltageMaxPhaseC : public ReadAttribute { +class ReadElectricalMeasurementAcOverloadAlarmsMask : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageMaxPhaseC() - : ReadAttribute("rms-voltage-max-phase-c") - { - } - - ~ReadElectricalMeasurementRmsVoltageMaxPhaseC() {} + ReadElectricalMeasurementAcOverloadAlarmsMask() + : ReadAttribute("ac-overload-alarms-mask") {} + + ~ReadElectricalMeasurementAcOverloadAlarmsMask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000800) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcOverloadAlarmsMaskWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcOverloadAlarmsMask response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcOverloadAlarmsMask read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A07) on endpoint %u", endpointId); +class WriteElectricalMeasurementAcOverloadAlarmsMask : public WriteAttribute { +public: + WriteElectricalMeasurementAcOverloadAlarmsMask() + : WriteAttribute("ac-overload-alarms-mask") { + AddArgument("attr-name", "ac-overload-alarms-mask"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteElectricalMeasurementAcOverloadAlarmsMask() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) WriteAttribute (0x00000800) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeAcOverloadAlarmsMaskWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("ElectricalMeasurement " + "AcOverloadAlarmsMask " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageMaxPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageMaxPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +private: + uint16_t mValue; }; -class SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC : public SubscribeAttribute { +class SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask + : public SubscribeAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC() - : SubscribeAttribute("rms-voltage-max-phase-c") - { - } + SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask() + : SubscribeAttribute("ac-overload-alarms-mask") {} - ~SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC() {} + ~SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A07) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000800) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcOverloadAlarmsMaskWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRmsVoltageMaxPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcOverloadAlarmsMask response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentPhaseC + * Attribute AcVoltageOverload */ -class ReadElectricalMeasurementRmsCurrentPhaseC : public ReadAttribute { +class ReadElectricalMeasurementAcVoltageOverload : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentPhaseC() - : ReadAttribute("rms-current-phase-c") - { - } - - ~ReadElectricalMeasurementRmsCurrentPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A08) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcVoltageOverload() + : ReadAttribute("ac-voltage-overload") {} + + ~ReadElectricalMeasurementAcVoltageOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000801) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcVoltageOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcVoltageOverload read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcVoltageOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcVoltageOverload() + : SubscribeAttribute("ac-voltage-overload") {} + + ~SubscribeAttributeElectricalMeasurementAcVoltageOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000801) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcVoltageOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcVoltageOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC : public SubscribeAttribute { +/* + * Attribute AcCurrentOverload + */ +class ReadElectricalMeasurementAcCurrentOverload : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC() - : SubscribeAttribute("rms-current-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC() {} + ReadElectricalMeasurementAcCurrentOverload() + : ReadAttribute("ac-current-overload") {} + + ~ReadElectricalMeasurementAcCurrentOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000802) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcCurrentOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcCurrentOverload read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcCurrentOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcCurrentOverload() + : SubscribeAttribute("ac-current-overload") {} + + ~SubscribeAttributeElectricalMeasurementAcCurrentOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000802) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcCurrentOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcCurrentOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A08) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute AcActivePowerOverload + */ +class ReadElectricalMeasurementAcActivePowerOverload : public ReadAttribute { +public: + ReadElectricalMeasurementAcActivePowerOverload() + : ReadAttribute("ac-active-power-overload") {} + + ~ReadElectricalMeasurementAcActivePowerOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000803) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcActivePowerOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcActivePowerOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcActivePowerOverload read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcActivePowerOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcActivePowerOverload() + : SubscribeAttribute("ac-active-power-overload") {} + + ~SubscribeAttributeElectricalMeasurementAcActivePowerOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000803) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcActivePowerOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcActivePowerOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute AcReactivePowerOverload + */ +class ReadElectricalMeasurementAcReactivePowerOverload : public ReadAttribute { +public: + ReadElectricalMeasurementAcReactivePowerOverload() + : ReadAttribute("ac-reactive-power-overload") {} + + ~ReadElectricalMeasurementAcReactivePowerOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000804) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcReactivePowerOverloadWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcReactivePowerOverload response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcReactivePowerOverload read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcReactivePowerOverload + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcReactivePowerOverload() + : SubscribeAttribute("ac-reactive-power-overload") {} + + ~SubscribeAttributeElectricalMeasurementAcReactivePowerOverload() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000804) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcReactivePowerOverloadWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcReactivePowerOverload response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentMinPhaseC + * Attribute AverageRmsOverVoltage */ -class ReadElectricalMeasurementRmsCurrentMinPhaseC : public ReadAttribute { +class ReadElectricalMeasurementAverageRmsOverVoltage : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentMinPhaseC() - : ReadAttribute("rms-current-min-phase-c") - { - } + ReadElectricalMeasurementAverageRmsOverVoltage() + : ReadAttribute("average-rms-over-voltage") {} + + ~ReadElectricalMeasurementAverageRmsOverVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000805) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsOverVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsOverVoltage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage() + : SubscribeAttribute("average-rms-over-voltage") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000805) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAverageRmsOverVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementRmsCurrentMinPhaseC() {} +/* + * Attribute AverageRmsUnderVoltage + */ +class ReadElectricalMeasurementAverageRmsUnderVoltage : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsUnderVoltage() + : ReadAttribute("average-rms-under-voltage") {} + + ~ReadElectricalMeasurementAverageRmsUnderVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000806) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsUnderVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsUnderVoltage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage() + : SubscribeAttribute("average-rms-under-voltage") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000806) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAverageRmsUnderVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A09) on endpoint %u", endpointId); +/* + * Attribute RmsExtremeOverVoltage + */ +class ReadElectricalMeasurementRmsExtremeOverVoltage : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeOverVoltage() + : ReadAttribute("rms-extreme-over-voltage") {} + + ~ReadElectricalMeasurementRmsExtremeOverVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000807) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeOverVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeOverVoltage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage() + : SubscribeAttribute("rms-extreme-over-voltage") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000807) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsExtremeOverVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMinPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMinPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute RmsExtremeUnderVoltage + */ +class ReadElectricalMeasurementRmsExtremeUnderVoltage : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeUnderVoltage() + : ReadAttribute("rms-extreme-under-voltage") {} + + ~ReadElectricalMeasurementRmsExtremeUnderVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000808) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeUnderVoltageWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltage response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeUnderVoltage read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage() + : SubscribeAttribute("rms-extreme-under-voltage") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000808) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsExtremeUnderVoltageWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltage response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC : public SubscribeAttribute { +/* + * Attribute RmsVoltageSag + */ +class ReadElectricalMeasurementRmsVoltageSag : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC() - : SubscribeAttribute("rms-current-min-phase-c") - { - } + ReadElectricalMeasurementRmsVoltageSag() : ReadAttribute("rms-voltage-sag") {} + + ~ReadElectricalMeasurementRmsVoltageSag() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000809) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSagWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSag response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSag read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSag + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSag() + : SubscribeAttribute("rms-voltage-sag") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSag() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000809) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSagWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSag response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC() {} +/* + * Attribute RmsVoltageSwell + */ +class ReadElectricalMeasurementRmsVoltageSwell : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageSwell() + : ReadAttribute("rms-voltage-swell") {} + + ~ReadElectricalMeasurementRmsVoltageSwell() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000080A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSwellWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwell response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSwell read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSwell + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSwell() + : SubscribeAttribute("rms-voltage-swell") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSwell() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000080A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSwellWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwell response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A09) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentMinPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute LineCurrentPhaseB + */ +class ReadElectricalMeasurementLineCurrentPhaseB : public ReadAttribute { +public: + ReadElectricalMeasurementLineCurrentPhaseB() + : ReadAttribute("line-current-phase-b") {} + + ~ReadElectricalMeasurementLineCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000901) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLineCurrentPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.LineCurrentPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement LineCurrentPhaseB read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementLineCurrentPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementLineCurrentPhaseB() + : SubscribeAttribute("line-current-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementLineCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000901) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLineCurrentPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.LineCurrentPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute ActiveCurrentPhaseB + */ +class ReadElectricalMeasurementActiveCurrentPhaseB : public ReadAttribute { +public: + ReadElectricalMeasurementActiveCurrentPhaseB() + : ReadAttribute("active-current-phase-b") {} + + ~ReadElectricalMeasurementActiveCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000902) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveCurrentPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActiveCurrentPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB() + : SubscribeAttribute("active-current-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000902) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveCurrentPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsCurrentMaxPhaseC + * Attribute ReactiveCurrentPhaseB */ -class ReadElectricalMeasurementRmsCurrentMaxPhaseC : public ReadAttribute { +class ReadElectricalMeasurementReactiveCurrentPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementRmsCurrentMaxPhaseC() - : ReadAttribute("rms-current-max-phase-c") - { - } - - ~ReadElectricalMeasurementRmsCurrentMaxPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsCurrentMaxPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsCurrentMaxPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementReactiveCurrentPhaseB() + : ReadAttribute("reactive-current-phase-b") {} + + ~ReadElectricalMeasurementReactiveCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000903) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReactiveCurrentPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ReactiveCurrentPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB() + : SubscribeAttribute("reactive-current-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000903) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReactiveCurrentPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC : public SubscribeAttribute { +/* + * Attribute RmsVoltagePhaseB + */ +class ReadElectricalMeasurementRmsVoltagePhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC() - : SubscribeAttribute("rms-current-max-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsCurrentMaxPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltagePhaseB() + : ReadAttribute("rms-voltage-phase-b") {} + + ~ReadElectricalMeasurementRmsVoltagePhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000905) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltagePhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltagePhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltagePhaseB read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB() + : SubscribeAttribute("rms-voltage-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltagePhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000905) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltagePhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltagePhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerPhaseC + * Attribute RmsVoltageMinPhaseB */ -class ReadElectricalMeasurementActivePowerPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsVoltageMinPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerPhaseC() - : ReadAttribute("active-power-phase-c") - { - } - - ~ReadElectricalMeasurementActivePowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltageMinPhaseB() + : ReadAttribute("rms-voltage-min-phase-b") {} + + ~ReadElectricalMeasurementRmsVoltageMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000906) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMinPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMinPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB() + : SubscribeAttribute("rms-voltage-min-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000906) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMinPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerPhaseC : public SubscribeAttribute { +/* + * Attribute RmsVoltageMaxPhaseB + */ +class ReadElectricalMeasurementRmsVoltageMaxPhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerPhaseC() - : SubscribeAttribute("active-power-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsVoltageMaxPhaseB() + : ReadAttribute("rms-voltage-max-phase-b") {} + + ~ReadElectricalMeasurementRmsVoltageMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000907) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMaxPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMaxPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB() + : SubscribeAttribute("rms-voltage-max-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000907) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMaxPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerMinPhaseC + * Attribute RmsCurrentPhaseB */ -class ReadElectricalMeasurementActivePowerMinPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsCurrentPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerMinPhaseC() - : ReadAttribute("active-power-min-phase-c") - { - } - - ~ReadElectricalMeasurementActivePowerMinPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMinPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMinPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentPhaseB() + : ReadAttribute("rms-current-phase-b") {} + + ~ReadElectricalMeasurementRmsCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000908) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentPhaseB read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB() + : SubscribeAttribute("rms-current-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000908) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC : public SubscribeAttribute { +/* + * Attribute RmsCurrentMinPhaseB + */ +class ReadElectricalMeasurementRmsCurrentMinPhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC() - : SubscribeAttribute("active-power-min-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerMinPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMinPhaseB() + : ReadAttribute("rms-current-min-phase-b") {} + + ~ReadElectricalMeasurementRmsCurrentMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000909) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMinPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMinPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB() + : SubscribeAttribute("rms-current-min-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000909) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMinPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ActivePowerMaxPhaseC + * Attribute RmsCurrentMaxPhaseB */ -class ReadElectricalMeasurementActivePowerMaxPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsCurrentMaxPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementActivePowerMaxPhaseC() - : ReadAttribute("active-power-max-phase-c") - { - } - - ~ReadElectricalMeasurementActivePowerMaxPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeActivePowerMaxPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ActivePowerMaxPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMaxPhaseB() + : ReadAttribute("rms-current-max-phase-b") {} + + ~ReadElectricalMeasurementRmsCurrentMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMaxPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMaxPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB() + : SubscribeAttribute("rms-current-max-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMaxPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC : public SubscribeAttribute { +/* + * Attribute ActivePowerPhaseB + */ +class ReadElectricalMeasurementActivePowerPhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC() - : SubscribeAttribute("active-power-max-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeActivePowerMaxPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerPhaseB() + : ReadAttribute("active-power-phase-b") {} + + ~ReadElectricalMeasurementActivePowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerPhaseB read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerPhaseB() + : SubscribeAttribute("active-power-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ReactivePowerPhaseC + * Attribute ActivePowerMinPhaseB */ -class ReadElectricalMeasurementReactivePowerPhaseC : public ReadAttribute { +class ReadElectricalMeasurementActivePowerMinPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementReactivePowerPhaseC() - : ReadAttribute("reactive-power-phase-c") - { - } - - ~ReadElectricalMeasurementReactivePowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeReactivePowerPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePowerPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ReactivePowerPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerMinPhaseB() + : ReadAttribute("active-power-min-phase-b") {} + + ~ReadElectricalMeasurementActivePowerMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMinPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMinPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB() + : SubscribeAttribute("active-power-min-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMinPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementReactivePowerPhaseC : public SubscribeAttribute { +/* + * Attribute ActivePowerMaxPhaseB + */ +class ReadElectricalMeasurementActivePowerMaxPhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementReactivePowerPhaseC() - : SubscribeAttribute("reactive-power-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementReactivePowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeReactivePowerPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ReactivePowerPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerMaxPhaseB() + : ReadAttribute("active-power-max-phase-b") {} + + ~ReadElectricalMeasurementActivePowerMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMaxPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMaxPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB() + : SubscribeAttribute("active-power-max-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMaxPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute ApparentPowerPhaseC + * Attribute ReactivePowerPhaseB */ -class ReadElectricalMeasurementApparentPowerPhaseC : public ReadAttribute { +class ReadElectricalMeasurementReactivePowerPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementApparentPowerPhaseC() - : ReadAttribute("apparent-power-phase-c") - { - } - - ~ReadElectricalMeasurementApparentPowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A0F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeApparentPowerPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPowerPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ApparentPowerPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementReactivePowerPhaseB() + : ReadAttribute("reactive-power-phase-b") {} + + ~ReadElectricalMeasurementReactivePowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReactivePowerPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePowerPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ReactivePowerPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementReactivePowerPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementReactivePowerPhaseB() + : SubscribeAttribute("reactive-power-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementReactivePowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReactivePowerPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePowerPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementApparentPowerPhaseC : public SubscribeAttribute { +/* + * Attribute ApparentPowerPhaseB + */ +class ReadElectricalMeasurementApparentPowerPhaseB : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementApparentPowerPhaseC() - : SubscribeAttribute("apparent-power-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementApparentPowerPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A0F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeApparentPowerPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ApparentPowerPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementApparentPowerPhaseB() + : ReadAttribute("apparent-power-phase-b") {} + + ~ReadElectricalMeasurementApparentPowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000090F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApparentPowerPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPowerPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ApparentPowerPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementApparentPowerPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementApparentPowerPhaseB() + : SubscribeAttribute("apparent-power-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementApparentPowerPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000090F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApparentPowerPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPowerPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute PowerFactorPhaseC + * Attribute PowerFactorPhaseB */ -class ReadElectricalMeasurementPowerFactorPhaseC : public ReadAttribute { +class ReadElectricalMeasurementPowerFactorPhaseB : public ReadAttribute { public: - ReadElectricalMeasurementPowerFactorPhaseC() - : ReadAttribute("power-factor-phase-c") - { - } + ReadElectricalMeasurementPowerFactorPhaseB() + : ReadAttribute("power-factor-phase-b") {} + + ~ReadElectricalMeasurementPowerFactorPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000910) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerFactorPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactorPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement PowerFactorPhaseB read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPowerFactorPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPowerFactorPhaseB() + : SubscribeAttribute("power-factor-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementPowerFactorPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000910) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerFactorPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactorPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~ReadElectricalMeasurementPowerFactorPhaseC() {} +/* + * Attribute AverageRmsVoltageMeasurementPeriodPhaseB + */ +class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() + : ReadAttribute("average-rms-voltage-measurement-period-phase-b") {} + + ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000911) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement." + @"AverageRmsVoltageMeasurementPeriodPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement " + "AverageRmsVoltageMeasurementPeriodPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() + : SubscribeAttribute("average-rms-voltage-measurement-period-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000911) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement." + @"AverageRmsVoltageMeasurementPeriodPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A10) on endpoint %u", endpointId); +/* + * Attribute AverageRmsOverVoltageCounterPhaseB + */ +class ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() + : ReadAttribute("average-rms-over-voltage-counter-phase-b") {} + + ~ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000912) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsOverVoltageCounterPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseB " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsOverVoltageCounterPhaseB " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() + : SubscribeAttribute("average-rms-over-voltage-counter-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000912) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsOverVoltageCounterPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseB " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributePowerFactorPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactorPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement PowerFactorPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AverageRmsUnderVoltageCounterPhaseB + */ +class ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() + : ReadAttribute("average-rms-under-voltage-counter-phase-b") {} + + ~ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000913) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsUnderVoltageCounterPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseB " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsUnderVoltageCounterPhaseB " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() + : SubscribeAttribute("average-rms-under-voltage-counter-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000913) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsUnderVoltageCounterPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseB " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementPowerFactorPhaseC : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementPowerFactorPhaseC() - : SubscribeAttribute("power-factor-phase-c") - { - } +/* + * Attribute RmsExtremeOverVoltagePeriodPhaseB + */ +class ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() + : ReadAttribute("rms-extreme-over-voltage-period-phase-b") {} + + ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000914) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeOverVoltagePeriodPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseB response " + @"%@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeOverVoltagePeriodPhaseB " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() + : SubscribeAttribute("rms-extreme-over-voltage-period-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000914) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeRmsExtremeOverVoltagePeriodPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseB " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementPowerFactorPhaseC() {} +/* + * Attribute RmsExtremeUnderVoltagePeriodPhaseB + */ +class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() + : ReadAttribute("rms-extreme-under-voltage-period-phase-b") {} + + ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000915) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeUnderVoltagePeriodPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseB " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeUnderVoltagePeriodPhaseB " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() + : SubscribeAttribute("rms-extreme-under-voltage-period-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000915) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseB " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A10) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributePowerFactorPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.PowerFactorPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute RmsVoltageSagPeriodPhaseB + */ +class ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB() + : ReadAttribute("rms-voltage-sag-period-phase-b") {} + + ~ReadElectricalMeasurementRmsVoltageSagPeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000916) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSagPeriodPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSagPeriodPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB() + : SubscribeAttribute("rms-voltage-sag-period-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000916) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSagPeriodPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute RmsVoltageSwellPeriodPhaseB + */ +class ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB() + : ReadAttribute("rms-voltage-swell-period-phase-b") {} + + ~ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000917) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSwellPeriodPhaseBWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseB response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement RmsVoltageSwellPeriodPhaseB read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB() + : SubscribeAttribute("rms-voltage-swell-period-phase-b") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000917) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSwellPeriodPhaseBWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseB response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsVoltageMeasurementPeriodPhaseC + * Attribute LineCurrentPhaseC */ -class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC : public ReadAttribute { +class ReadElectricalMeasurementLineCurrentPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() - : ReadAttribute("average-rms-voltage-measurement-period-phase-c") - { - } - - ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A11) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriodPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsVoltageMeasurementPeriodPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementLineCurrentPhaseC() + : ReadAttribute("line-current-phase-c") {} + + ~ReadElectricalMeasurementLineCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A01) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLineCurrentPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.LineCurrentPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement LineCurrentPhaseC read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementLineCurrentPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementLineCurrentPhaseC() + : SubscribeAttribute("line-current-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementLineCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A01) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLineCurrentPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.LineCurrentPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC : public SubscribeAttribute { +/* + * Attribute ActiveCurrentPhaseC + */ +class ReadElectricalMeasurementActiveCurrentPhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() - : SubscribeAttribute("average-rms-voltage-measurement-period-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A11) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsVoltageMeasurementPeriodPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActiveCurrentPhaseC() + : ReadAttribute("active-current-phase-c") {} + + ~ReadElectricalMeasurementActiveCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A02) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveCurrentPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActiveCurrentPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC() + : SubscribeAttribute("active-current-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A02) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveCurrentPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActiveCurrentPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsOverVoltageCounterPhaseC + * Attribute ReactiveCurrentPhaseC */ -class ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC : public ReadAttribute { +class ReadElectricalMeasurementReactiveCurrentPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() - : ReadAttribute("average-rms-over-voltage-counter-phase-c") - { - } - - ~ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A12) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeAverageRmsOverVoltageCounterPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsOverVoltageCounterPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementReactiveCurrentPhaseC() + : ReadAttribute("reactive-current-phase-c") {} + + ~ReadElectricalMeasurementReactiveCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A03) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReactiveCurrentPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ReactiveCurrentPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC() + : SubscribeAttribute("reactive-current-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A03) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReactiveCurrentPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactiveCurrentPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC : public SubscribeAttribute { +/* + * Attribute RmsVoltagePhaseC + */ +class ReadElectricalMeasurementRmsVoltagePhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() - : SubscribeAttribute("average-rms-over-voltage-counter-phase-c") - { - } + ReadElectricalMeasurementRmsVoltagePhaseC() + : ReadAttribute("rms-voltage-phase-c") {} + + ~ReadElectricalMeasurementRmsVoltagePhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A05) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltagePhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltagePhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltagePhaseC read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC() + : SubscribeAttribute("rms-voltage-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltagePhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A05) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltagePhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltagePhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() {} +/* + * Attribute RmsVoltageMinPhaseC + */ +class ReadElectricalMeasurementRmsVoltageMinPhaseC : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageMinPhaseC() + : ReadAttribute("rms-voltage-min-phase-c") {} + + ~ReadElectricalMeasurementRmsVoltageMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A06) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMinPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMinPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC() + : SubscribeAttribute("rms-voltage-min-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A06) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMinPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMinPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A12) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsOverVoltageCounterPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute RmsVoltageMaxPhaseC + */ +class ReadElectricalMeasurementRmsVoltageMaxPhaseC : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageMaxPhaseC() + : ReadAttribute("rms-voltage-max-phase-c") {} + + ~ReadElectricalMeasurementRmsVoltageMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A07) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageMaxPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageMaxPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC() + : SubscribeAttribute("rms-voltage-max-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A07) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageMaxPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageMaxPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute RmsCurrentPhaseC + */ +class ReadElectricalMeasurementRmsCurrentPhaseC : public ReadAttribute { +public: + ReadElectricalMeasurementRmsCurrentPhaseC() + : ReadAttribute("rms-current-phase-c") {} + + ~ReadElectricalMeasurementRmsCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A08) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentPhaseC read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC() + : SubscribeAttribute("rms-current-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A08) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute AverageRmsUnderVoltageCounterPhaseC + * Attribute RmsCurrentMinPhaseC */ -class ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC : public ReadAttribute { +class ReadElectricalMeasurementRmsCurrentMinPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() - : ReadAttribute("average-rms-under-voltage-counter-phase-c") - { - } - - ~ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A13) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAverageRmsUnderVoltageCounterPhaseCWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AverageRmsUnderVoltageCounterPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMinPhaseC() + : ReadAttribute("rms-current-min-phase-c") {} + + ~ReadElectricalMeasurementRmsCurrentMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A09) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMinPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMinPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC() + : SubscribeAttribute("rms-current-min-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A09) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMinPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMinPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC : public SubscribeAttribute { +/* + * Attribute RmsCurrentMaxPhaseC + */ +class ReadElectricalMeasurementRmsCurrentMaxPhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() - : SubscribeAttribute("average-rms-under-voltage-counter-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A13) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAverageRmsUnderVoltageCounterPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementRmsCurrentMaxPhaseC() + : ReadAttribute("rms-current-max-phase-c") {} + + ~ReadElectricalMeasurementRmsCurrentMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsCurrentMaxPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsCurrentMaxPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC() + : SubscribeAttribute("rms-current-max-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsCurrentMaxPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsCurrentMaxPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeOverVoltagePeriodPhaseC + * Attribute ActivePowerPhaseC */ -class ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC : public ReadAttribute { +class ReadElectricalMeasurementActivePowerPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() - : ReadAttribute("rms-extreme-over-voltage-period-phase-c") - { - } - - ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A14) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeRmsExtremeOverVoltagePeriodPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeOverVoltagePeriodPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerPhaseC() + : ReadAttribute("active-power-phase-c") {} + + ~ReadElectricalMeasurementActivePowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerPhaseC read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerPhaseC() + : SubscribeAttribute("active-power-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC : public SubscribeAttribute { +/* + * Attribute ActivePowerMinPhaseC + */ +class ReadElectricalMeasurementActivePowerMinPhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() - : SubscribeAttribute("rms-extreme-over-voltage-period-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A14) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsExtremeOverVoltagePeriodPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerMinPhaseC() + : ReadAttribute("active-power-min-phase-c") {} + + ~ReadElectricalMeasurementActivePowerMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMinPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMinPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC() + : SubscribeAttribute("active-power-min-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMinPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMinPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsExtremeUnderVoltagePeriodPhaseC + * Attribute ActivePowerMaxPhaseC */ -class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC : public ReadAttribute { +class ReadElectricalMeasurementActivePowerMaxPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() - : ReadAttribute("rms-extreme-under-voltage-period-phase-c") - { - } - - ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A15) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeRmsExtremeUnderVoltagePeriodPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsExtremeUnderVoltagePeriodPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementActivePowerMaxPhaseC() + : ReadAttribute("active-power-max-phase-c") {} + + ~ReadElectricalMeasurementActivePowerMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActivePowerMaxPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ActivePowerMaxPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC() + : SubscribeAttribute("active-power-max-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActivePowerMaxPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ActivePowerMaxPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC : public SubscribeAttribute { +/* + * Attribute ReactivePowerPhaseC + */ +class ReadElectricalMeasurementReactivePowerPhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() - : SubscribeAttribute("rms-extreme-under-voltage-period-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A15) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementReactivePowerPhaseC() + : ReadAttribute("reactive-power-phase-c") {} + + ~ReadElectricalMeasurementReactivePowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeReactivePowerPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePowerPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ReactivePowerPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementReactivePowerPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementReactivePowerPhaseC() + : SubscribeAttribute("reactive-power-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementReactivePowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeReactivePowerPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ReactivePowerPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSagPeriodPhaseC + * Attribute ApparentPowerPhaseC */ -class ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC : public ReadAttribute { +class ReadElectricalMeasurementApparentPowerPhaseC : public ReadAttribute { public: - ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC() - : ReadAttribute("rms-voltage-sag-period-phase-c") - { - } - - ~ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A16) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSagPeriodPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSagPeriodPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementApparentPowerPhaseC() + : ReadAttribute("apparent-power-phase-c") {} + + ~ReadElectricalMeasurementApparentPowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A0F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeApparentPowerPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPowerPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ApparentPowerPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementApparentPowerPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementApparentPowerPhaseC() + : SubscribeAttribute("apparent-power-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementApparentPowerPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A0F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeApparentPowerPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ApparentPowerPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC : public SubscribeAttribute { +/* + * Attribute PowerFactorPhaseC + */ +class ReadElectricalMeasurementPowerFactorPhaseC : public ReadAttribute { public: - SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC() - : SubscribeAttribute("rms-voltage-sag-period-phase-c") - { - } - - ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A16) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageSagPeriodPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementPowerFactorPhaseC() + : ReadAttribute("power-factor-phase-c") {} + + ~ReadElectricalMeasurementPowerFactorPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A10) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributePowerFactorPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactorPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement PowerFactorPhaseC read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementPowerFactorPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementPowerFactorPhaseC() + : SubscribeAttribute("power-factor-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementPowerFactorPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A10) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePowerFactorPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.PowerFactorPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* - * Attribute RmsVoltageSwellPeriodPhaseC + * Attribute AverageRmsVoltageMeasurementPeriodPhaseC */ -class ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC : public ReadAttribute { -public: - ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC() - : ReadAttribute("rms-voltage-swell-period-phase-c") - { - } - - ~ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC() {} +class ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() + : ReadAttribute("average-rms-voltage-measurement-period-phase-c") {} + + ~ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A11) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster + readAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement." + @"AverageRmsVoltageMeasurementPeriodPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement " + "AverageRmsVoltageMeasurementPeriodPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() + : SubscribeAttribute("average-rms-voltage-measurement-period-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A11) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithParams: + params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement." + @"AverageRmsVoltageMeasurementPeriodPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x00000A17) on endpoint %u", endpointId); +/* + * Attribute AverageRmsOverVoltageCounterPhaseC + */ +class ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() + : ReadAttribute("average-rms-over-voltage-counter-phase-c") {} + + ~ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A12) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsOverVoltageCounterPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseC " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsOverVoltageCounterPhaseC " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() + : SubscribeAttribute("average-rms-over-voltage-counter-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A12) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsOverVoltageCounterPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsOverVoltageCounterPhaseC " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRmsVoltageSwellPeriodPhaseCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseC response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement RmsVoltageSwellPeriodPhaseC read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +/* + * Attribute AverageRmsUnderVoltageCounterPhaseC + */ +class ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() + : ReadAttribute("average-rms-under-voltage-counter-phase-c") {} + + ~ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A13) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAverageRmsUnderVoltageCounterPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseC " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AverageRmsUnderVoltageCounterPhaseC " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() + : SubscribeAttribute("average-rms-under-voltage-counter-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A13) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeAverageRmsUnderVoltageCounterPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AverageRmsUnderVoltageCounterPhaseC " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; -class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC() - : SubscribeAttribute("rms-voltage-swell-period-phase-c") - { - } +/* + * Attribute RmsExtremeOverVoltagePeriodPhaseC + */ +class ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() + : ReadAttribute("rms-extreme-over-voltage-period-phase-c") {} + + ~ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A14) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeOverVoltagePeriodPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseC response " + @"%@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeOverVoltagePeriodPhaseC " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() + : SubscribeAttribute("rms-extreme-over-voltage-period-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A14) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeRmsExtremeOverVoltagePeriodPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeOverVoltagePeriodPhaseC " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC() {} +/* + * Attribute RmsExtremeUnderVoltagePeriodPhaseC + */ +class ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() + : ReadAttribute("rms-extreme-under-voltage-period-phase-c") {} + + ~ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A15) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsExtremeUnderVoltagePeriodPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseC " + @"response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsExtremeUnderVoltagePeriodPhaseC " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() + : SubscribeAttribute("rms-extreme-under-voltage-period-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC() { + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A15) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster + subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsExtremeUnderVoltagePeriodPhaseC " + @"response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x00000A17) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeRmsVoltageSwellPeriodPhaseCWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseC response %@", [value description]); - SetCommandExitStatus(error); - }]; +/* + * Attribute RmsVoltageSagPeriodPhaseC + */ +class ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC() + : ReadAttribute("rms-voltage-sag-period-phase-c") {} + + ~ReadElectricalMeasurementRmsVoltageSagPeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A16) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSagPeriodPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement RmsVoltageSagPeriodPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC() + : SubscribeAttribute("rms-voltage-sag-period-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A16) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSagPeriodPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSagPeriodPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; - return CHIP_NO_ERROR; - } +/* + * Attribute RmsVoltageSwellPeriodPhaseC + */ +class ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC + : public ReadAttribute { +public: + ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC() + : ReadAttribute("rms-voltage-swell-period-phase-c") {} + + ~ReadElectricalMeasurementRmsVoltageSwellPeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x00000A17) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRmsVoltageSwellPeriodPhaseCWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseC response %@", + [value description]); + if (error != nil) { + LogNSError( + "ElectricalMeasurement RmsVoltageSwellPeriodPhaseC read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC() + : SubscribeAttribute("rms-voltage-swell-period-phase-c") {} + + ~SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x00000A17) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRmsVoltageSwellPeriodPhaseCWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog( + @"ElectricalMeasurement.RmsVoltageSwellPeriodPhaseC response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -85706,69 +101124,82 @@ class SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC : publi */ class ReadElectricalMeasurementGeneratedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadElectricalMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeElectricalMeasurementGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadElectricalMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement GeneratedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeElectricalMeasurementGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -85776,69 +101207,82 @@ class SubscribeAttributeElectricalMeasurementGeneratedCommandList : public Subsc */ class ReadElectricalMeasurementAcceptedCommandList : public ReadAttribute { public: - ReadElectricalMeasurementAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadElectricalMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeElectricalMeasurementAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadElectricalMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AcceptedCommandList read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeElectricalMeasurementAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -85846,69 +101290,80 @@ class SubscribeAttributeElectricalMeasurementAcceptedCommandList : public Subscr */ class ReadElectricalMeasurementAttributeList : public ReadAttribute { public: - ReadElectricalMeasurementAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadElectricalMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementAttributeList : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementAttributeList() - : SubscribeAttribute("attribute-list") - { - } - - ~SubscribeAttributeElectricalMeasurementAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadElectricalMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AttributeList response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementAttributeList + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementAttributeList() + : SubscribeAttribute("attribute-list") {} + + ~SubscribeAttributeElectricalMeasurementAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.AttributeList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -85916,69 +101371,80 @@ class SubscribeAttributeElectricalMeasurementAttributeList : public SubscribeAtt */ class ReadElectricalMeasurementFeatureMap : public ReadAttribute { public: - ReadElectricalMeasurementFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadElectricalMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementFeatureMap : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementFeatureMap() - : SubscribeAttribute("feature-map") - { - } - - ~SubscribeAttributeElectricalMeasurementFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadElectricalMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.FeatureMap response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementFeatureMap + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementFeatureMap() + : SubscribeAttribute("feature-map") {} + + ~SubscribeAttributeElectricalMeasurementFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.FeatureMap response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -85986,73 +101452,86 @@ class SubscribeAttributeElectricalMeasurementFeatureMap : public SubscribeAttrib */ class ReadElectricalMeasurementClusterRevision : public ReadAttribute { public: - ReadElectricalMeasurementClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadElectricalMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("ElectricalMeasurement ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeAttribute { -public: - SubscribeAttributeElectricalMeasurementClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } - - ~SubscribeAttributeElectricalMeasurementClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ElectricalMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadElectricalMeasurementClusterRevision() + : ReadAttribute("cluster-revision") {} + + ~ReadElectricalMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ClusterRevision response %@", + [value description]); + if (error != nil) { + LogNSError("ElectricalMeasurement ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalMeasurementClusterRevision + : public SubscribeAttribute { +public: + SubscribeAttributeElectricalMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") {} + + ~SubscribeAttributeElectricalMeasurementClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0x00000B04) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = [[MTRBaseClusterElectricalMeasurement alloc] + initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"ElectricalMeasurement.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ -| Cluster UnitTesting | 0xFFF1FC05| +| Cluster UnitTesting | +0xFFF1FC05| |------------------------------------------------------------------------------| | Commands: | | | * Test | 0x00 | @@ -86177,40 +101656,44 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeA */ class UnitTestingTest : public ClusterCommand { public: - UnitTestingTest() - : ClusterCommand("test") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } + UnitTestingTest() : ClusterCommand("test") { ClusterCommand::AddArguments(); } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000000) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRUnitTestingClusterTestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } private: }; @@ -86218,42 +101701,49 @@ class UnitTestingTest : public ClusterCommand { /* * Command TestNotHandled */ -class UnitTestingTestNotHandled : public ClusterCommand { -public: - UnitTestingTestNotHandled() - : ClusterCommand("test-not-handled") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestNotHandledParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testNotHandledWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; +class UnitTestingTestNotHandled : public ClusterCommand { +public: + UnitTestingTestNotHandled() : ClusterCommand("test-not-handled") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000001) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestNotHandledParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testNotHandledWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -86263,42 +101753,51 @@ class UnitTestingTestNotHandled : public ClusterCommand { */ class UnitTestingTestSpecific : public ClusterCommand { public: - UnitTestingTestSpecific() - : ClusterCommand("test-specific") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestSpecificParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testSpecificWithParams:params - completion:^(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestSpecific() : ClusterCommand("test-specific") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000002) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestSpecificParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testSpecificWithParams:params + completion:^( + MTRUnitTestingClusterTestSpecificResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -86308,40 +101807,47 @@ class UnitTestingTestSpecific : public ClusterCommand { */ class UnitTestingTestUnknownCommand : public ClusterCommand { public: - UnitTestingTestUnknownCommand() - : ClusterCommand("test-unknown-command") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestUnknownCommandParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testUnknownCommandWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestUnknownCommand() : ClusterCommand("test-unknown-command") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000003) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestUnknownCommandParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testUnknownCommandWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -86351,49 +101857,59 @@ class UnitTestingTestUnknownCommand : public ClusterCommand { */ class UnitTestingTestAddArguments : public ClusterCommand { public: - UnitTestingTestAddArguments() - : ClusterCommand("test-add-arguments") - { - AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); - AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; - params.arg2 = [NSNumber numberWithUnsignedChar:mRequest.arg2]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testAddArgumentsWithParams:params - completion:^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestAddArguments() : ClusterCommand("test-add-arguments") { + AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); + AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000004) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; + params.arg2 = [NSNumber numberWithUnsignedChar:mRequest.arg2]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testAddArgumentsWithParams:params + completion:^( + MTRUnitTestingClusterTestAddArgumentsResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type mRequest; + chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type mRequest; }; /* @@ -86401,47 +101917,59 @@ class UnitTestingTestAddArguments : public ClusterCommand { */ class UnitTestingTestSimpleArgumentRequest : public ClusterCommand { public: - UnitTestingTestSimpleArgumentRequest() - : ClusterCommand("test-simple-argument-request") - { - AddArgument("Arg1", 0, 1, &mRequest.arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestSimpleArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [NSNumber numberWithBool:mRequest.arg1]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testSimpleArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestSimpleArgumentRequest() + : ClusterCommand("test-simple-argument-request") { + AddArgument("Arg1", 0, 1, &mRequest.arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000005) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestSimpleArgumentRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [NSNumber numberWithBool:mRequest.arg1]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testSimpleArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestSimpleArgumentResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type + mRequest; }; /* @@ -86449,170 +101977,194 @@ class UnitTestingTestSimpleArgumentRequest : public ClusterCommand { */ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { public: - UnitTestingTestStructArrayArgumentRequest() - : ClusterCommand("test-struct-array-argument-request") - , mComplex_Arg1(&mRequest.arg1) - , mComplex_Arg2(&mRequest.arg2) - , mComplex_Arg3(&mRequest.arg3) - , mComplex_Arg4(&mRequest.arg4) - { - AddArgument("Arg1", &mComplex_Arg1); - AddArgument("Arg2", &mComplex_Arg2); - AddArgument("Arg3", &mComplex_Arg3); - AddArgument("Arg4", &mComplex_Arg4); - AddArgument("Arg5", 0, UINT8_MAX, &mRequest.arg5); - AddArgument("Arg6", 0, 1, &mRequest.arg6); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestStructArrayArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + UnitTestingTestStructArrayArgumentRequest() + : ClusterCommand("test-struct-array-argument-request"), + mComplex_Arg1(&mRequest.arg1), mComplex_Arg2(&mRequest.arg2), + mComplex_Arg3(&mRequest.arg3), mComplex_Arg4(&mRequest.arg4) { + AddArgument("Arg1", &mComplex_Arg1); + AddArgument("Arg2", &mComplex_Arg2); + AddArgument("Arg3", &mComplex_Arg3); + AddArgument("Arg4", &mComplex_Arg4); + AddArgument("Arg5", 0, UINT8_MAX, &mRequest.arg5); + AddArgument("Arg6", 0, 1, &mRequest.arg6); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000006) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestStructArrayArgumentRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg1) { + MTRUnitTestingClusterNestedStructList *newElement_0; + newElement_0 = [MTRUnitTestingClusterNestedStructList new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; + newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; + newElement_0.c.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; + newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() + length:entry_0.c.d.size()]; + newElement_0.c.e = + [[NSString alloc] initWithBytes:entry_0.c.e.data() + length:entry_0.c.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; + newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; + newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg1) { - MTRUnitTestingClusterNestedStructList * newElement_0; - newElement_0 = [MTRUnitTestingClusterNestedStructList new]; - newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; - newElement_0.b = [NSNumber numberWithBool:entry_0.b]; - newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; - newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; - newElement_0.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; - newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() length:entry_0.c.d.size()]; - newElement_0.c.e = [[NSString alloc] initWithBytes:entry_0.c.e.data() - length:entry_0.c.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; - newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; - newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.d) { - MTRUnitTestingClusterSimpleStruct * newElement_2; - newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; - newElement_2.b = [NSNumber numberWithBool:entry_2.b]; - newElement_2.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; - newElement_2.d = [NSData dataWithBytes:entry_2.d.data() length:entry_2.d.size()]; - newElement_2.e = [[NSString alloc] initWithBytes:entry_2.e.data() - length:entry_2.e.size() - encoding:NSUTF8StringEncoding]; - newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; - newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; - newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; - [array_2 addObject:newElement_2]; - } - newElement_0.d = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.e) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; - [array_2 addObject:newElement_2]; - } - newElement_0.e = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.f) { - NSData * newElement_2; - newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; - [array_2 addObject:newElement_2]; - } - newElement_0.f = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.g) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; - [array_2 addObject:newElement_2]; - } - newElement_0.g = array_2; - } - [array_0 addObject:newElement_0]; - } - params.arg1 = array_0; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.d) { + MTRUnitTestingClusterSimpleStruct *newElement_2; + newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; + newElement_2.b = [NSNumber numberWithBool:entry_2.b]; + newElement_2.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; + newElement_2.d = [NSData dataWithBytes:entry_2.d.data() + length:entry_2.d.size()]; + newElement_2.e = + [[NSString alloc] initWithBytes:entry_2.e.data() + length:entry_2.e.size() + encoding:NSUTF8StringEncoding]; + newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; + newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; + newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; + [array_2 addObject:newElement_2]; + } + newElement_0.d = array_2; } { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg2) { - MTRUnitTestingClusterSimpleStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; - newElement_0.b = [NSNumber numberWithBool:entry_0.b]; - newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; - newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; - newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() - length:entry_0.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; - newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; - newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; - [array_0 addObject:newElement_0]; - } - params.arg2 = array_0; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.e) { + NSNumber *newElement_2; + newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; + [array_2 addObject:newElement_2]; + } + newElement_0.e = array_2; } { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg3) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - params.arg3 = array_0; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.f) { + NSData *newElement_2; + newElement_2 = [NSData dataWithBytes:entry_2.data() + length:entry_2.size()]; + [array_2 addObject:newElement_2]; + } + newElement_0.f = array_2; } { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg4) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithBool:entry_0]; - [array_0 addObject:newElement_0]; - } - params.arg4 = array_0; - } - params.arg5 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg5)]; - params.arg6 = [NSNumber numberWithBool:mRequest.arg6]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testStructArrayArgumentRequestWithParams:params - completion:^( - MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.g) { + NSNumber *newElement_2; + newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; + [array_2 addObject:newElement_2]; + } + newElement_0.g = array_2; + } + [array_0 addObject:newElement_0]; + } + params.arg1 = array_0; + } + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg2) { + MTRUnitTestingClusterSimpleStruct *newElement_0; + newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; + newElement_0.d = [NSData dataWithBytes:entry_0.d.data() + length:entry_0.d.size()]; + newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() + length:entry_0.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; + newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; + newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + [array_0 addObject:newElement_0]; + } + params.arg2 = array_0; + } + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg3) { + NSNumber *newElement_0; + newElement_0 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + params.arg3 = array_0; + } + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg4) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithBool:entry_0]; + [array_0 addObject:newElement_0]; + } + params.arg4 = array_0; + } + params.arg5 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg5)]; + params.arg6 = [NSNumber numberWithBool:mRequest.arg6]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testStructArrayArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestStructArrayArgumentResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest::Type mRequest; - TypedComplexArgument> - mComplex_Arg1; - TypedComplexArgument> - mComplex_Arg2; - TypedComplexArgument> mComplex_Arg3; - TypedComplexArgument> mComplex_Arg4; + chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest:: + Type mRequest; + TypedComplexArgument> + mComplex_Arg1; + TypedComplexArgument> + mComplex_Arg2; + TypedComplexArgument> + mComplex_Arg3; + TypedComplexArgument> mComplex_Arg4; }; /* @@ -86620,59 +102172,75 @@ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { */ class UnitTestingTestStructArgumentRequest : public ClusterCommand { public: - UnitTestingTestStructArgumentRequest() - : ClusterCommand("test-struct-argument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestStructArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; - params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; - params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; - params.arg1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; - params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() length:mRequest.arg1.d.size()]; - params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() - length:mRequest.arg1.e.size() - encoding:NSUTF8StringEncoding]; - params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; - params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; - params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testStructArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestStructArgumentRequest() + : ClusterCommand("test-struct-argument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000007) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestStructArgumentRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; + params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; + params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; + params.arg1.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; + params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() + length:mRequest.arg1.d.size()]; + params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() + length:mRequest.arg1.e.size() + encoding:NSUTF8StringEncoding]; + params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; + params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; + params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testStructArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type mRequest; - TypedComplexArgument mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type + mRequest; + TypedComplexArgument< + chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type> + mComplex_Arg1; }; /* @@ -86680,62 +102248,79 @@ class UnitTestingTestStructArgumentRequest : public ClusterCommand { */ class UnitTestingTestNestedStructArgumentRequest : public ClusterCommand { public: - UnitTestingTestNestedStructArgumentRequest() - : ClusterCommand("test-nested-struct-argument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestNestedStructArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [MTRUnitTestingClusterNestedStruct new]; - params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; - params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; - params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; - params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; - params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; - params.arg1.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; - params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() length:mRequest.arg1.c.d.size()]; - params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() - length:mRequest.arg1.c.e.size() - encoding:NSUTF8StringEncoding]; - params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; - params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; - params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testNestedStructArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestNestedStructArgumentRequest() + : ClusterCommand("test-nested-struct-argument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000008) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestNestedStructArgumentRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [MTRUnitTestingClusterNestedStruct new]; + params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; + params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; + params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; + params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; + params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; + params.arg1.c.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; + params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() + length:mRequest.arg1.c.d.size()]; + params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() + length:mRequest.arg1.c.e.size() + encoding:NSUTF8StringEncoding]; + params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; + params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; + params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testNestedStructArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Type mRequest; - TypedComplexArgument mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest:: + Type mRequest; + TypedComplexArgument< + chip::app::Clusters::UnitTesting::Structs::NestedStruct::Type> + mComplex_Arg1; }; /* @@ -86743,68 +102328,83 @@ class UnitTestingTestNestedStructArgumentRequest : public ClusterCommand { */ class UnitTestingTestListStructArgumentRequest : public ClusterCommand { public: - UnitTestingTestListStructArgumentRequest() - : ClusterCommand("test-list-struct-argument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestListStructArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg1) { - MTRUnitTestingClusterSimpleStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; - newElement_0.b = [NSNumber numberWithBool:entry_0.b]; - newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; - newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; - newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() - length:entry_0.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; - newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; - newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; - [array_0 addObject:newElement_0]; - } - params.arg1 = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testListStructArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestListStructArgumentRequest() + : ClusterCommand("test-list-struct-argument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000009) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestListStructArgumentRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg1) { + MTRUnitTestingClusterSimpleStruct *newElement_0; + newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; + newElement_0.d = [NSData dataWithBytes:entry_0.d.data() + length:entry_0.d.size()]; + newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() + length:entry_0.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; + newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; + newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + [array_0 addObject:newElement_0]; + } + params.arg1 = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testListStructArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Type mRequest; - TypedComplexArgument> - mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest:: + Type mRequest; + TypedComplexArgument> + mComplex_Arg1; }; /* @@ -86812,57 +102412,69 @@ class UnitTestingTestListStructArgumentRequest : public ClusterCommand { */ class UnitTestingTestListInt8UArgumentRequest : public ClusterCommand { public: - UnitTestingTestListInt8UArgumentRequest() - : ClusterCommand("test-list-int8uargument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg1) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; - [array_0 addObject:newElement_0]; - } - params.arg1 = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testListInt8UArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestListInt8UArgumentRequest() + : ClusterCommand("test-list-int8uargument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000A) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg1) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + params.arg1 = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testListInt8UArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type mRequest; - TypedComplexArgument> mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type + mRequest; + TypedComplexArgument> mComplex_Arg1; }; /* @@ -86870,227 +102482,269 @@ class UnitTestingTestListInt8UArgumentRequest : public ClusterCommand { */ class UnitTestingTestNestedStructListArgumentRequest : public ClusterCommand { public: - UnitTestingTestNestedStructListArgumentRequest() - : ClusterCommand("test-nested-struct-list-argument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestNestedStructListArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [MTRUnitTestingClusterNestedStructList new]; - params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; - params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; - params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; - params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; - params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; - params.arg1.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; - params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() length:mRequest.arg1.c.d.size()]; - params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() - length:mRequest.arg1.c.e.size() - encoding:NSUTF8StringEncoding]; - params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; - params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; - params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.arg1.d) { - MTRUnitTestingClusterSimpleStruct * newElement_1; - newElement_1 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_1.a = [NSNumber numberWithUnsignedChar:entry_1.a]; - newElement_1.b = [NSNumber numberWithBool:entry_1.b]; - newElement_1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.c)]; - newElement_1.d = [NSData dataWithBytes:entry_1.d.data() length:entry_1.d.size()]; - newElement_1.e = [[NSString alloc] initWithBytes:entry_1.e.data() - length:entry_1.e.size() - encoding:NSUTF8StringEncoding]; - newElement_1.f = [NSNumber numberWithUnsignedChar:entry_1.f.Raw()]; - newElement_1.g = [NSNumber numberWithFloat:entry_1.g]; - newElement_1.h = [NSNumber numberWithDouble:entry_1.h]; - [array_1 addObject:newElement_1]; - } - params.arg1.d = array_1; - } - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.arg1.e) { - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedInt:entry_1]; - [array_1 addObject:newElement_1]; - } - params.arg1.e = array_1; - } - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.arg1.f) { - NSData * newElement_1; - newElement_1 = [NSData dataWithBytes:entry_1.data() length:entry_1.size()]; - [array_1 addObject:newElement_1]; - } - params.arg1.f = array_1; - } - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.arg1.g) { - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedChar:entry_1]; - [array_1 addObject:newElement_1]; - } - params.arg1.g = array_1; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testNestedStructListArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestNestedStructListArgumentRequest() + : ClusterCommand("test-nested-struct-list-argument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000B) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestNestedStructListArgumentRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [MTRUnitTestingClusterNestedStructList new]; + params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; + params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; + params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; + params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; + params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; + params.arg1.c.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; + params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() + length:mRequest.arg1.c.d.size()]; + params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() + length:mRequest.arg1.c.e.size() + encoding:NSUTF8StringEncoding]; + params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; + params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; + params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.arg1.d) { + MTRUnitTestingClusterSimpleStruct *newElement_1; + newElement_1 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_1.a = [NSNumber numberWithUnsignedChar:entry_1.a]; + newElement_1.b = [NSNumber numberWithBool:entry_1.b]; + newElement_1.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.c)]; + newElement_1.d = [NSData dataWithBytes:entry_1.d.data() + length:entry_1.d.size()]; + newElement_1.e = [[NSString alloc] initWithBytes:entry_1.e.data() + length:entry_1.e.size() + encoding:NSUTF8StringEncoding]; + newElement_1.f = [NSNumber numberWithUnsignedChar:entry_1.f.Raw()]; + newElement_1.g = [NSNumber numberWithFloat:entry_1.g]; + newElement_1.h = [NSNumber numberWithDouble:entry_1.h]; + [array_1 addObject:newElement_1]; + } + params.arg1.d = array_1; + } + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.arg1.e) { + NSNumber *newElement_1; + newElement_1 = [NSNumber numberWithUnsignedInt:entry_1]; + [array_1 addObject:newElement_1]; + } + params.arg1.e = array_1; + } + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.arg1.f) { + NSData *newElement_1; + newElement_1 = [NSData dataWithBytes:entry_1.data() + length:entry_1.size()]; + [array_1 addObject:newElement_1]; + } + params.arg1.f = array_1; + } + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.arg1.g) { + NSNumber *newElement_1; + newElement_1 = [NSNumber numberWithUnsignedChar:entry_1]; + [array_1 addObject:newElement_1]; + } + params.arg1.g = array_1; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testNestedStructListArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Type mRequest; - TypedComplexArgument mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands:: + TestNestedStructListArgumentRequest::Type mRequest; + TypedComplexArgument< + chip::app::Clusters::UnitTesting::Structs::NestedStructList::Type> + mComplex_Arg1; }; /* * Command TestListNestedStructListArgumentRequest */ -class UnitTestingTestListNestedStructListArgumentRequest : public ClusterCommand { -public: - UnitTestingTestListNestedStructListArgumentRequest() - : ClusterCommand("test-list-nested-struct-list-argument-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +class UnitTestingTestListNestedStructListArgumentRequest + : public ClusterCommand { +public: + UnitTestingTestListNestedStructListArgumentRequest() + : ClusterCommand("test-list-nested-struct-list-argument-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000C) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams + alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg1) { + MTRUnitTestingClusterNestedStructList *newElement_0; + newElement_0 = [MTRUnitTestingClusterNestedStructList new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; + newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; + newElement_0.c.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; + newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() + length:entry_0.c.d.size()]; + newElement_0.c.e = + [[NSString alloc] initWithBytes:entry_0.c.e.data() + length:entry_0.c.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; + newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; + newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg1) { - MTRUnitTestingClusterNestedStructList * newElement_0; - newElement_0 = [MTRUnitTestingClusterNestedStructList new]; - newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; - newElement_0.b = [NSNumber numberWithBool:entry_0.b]; - newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; - newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; - newElement_0.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; - newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() length:entry_0.c.d.size()]; - newElement_0.c.e = [[NSString alloc] initWithBytes:entry_0.c.e.data() - length:entry_0.c.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; - newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; - newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.d) { - MTRUnitTestingClusterSimpleStruct * newElement_2; - newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; - newElement_2.b = [NSNumber numberWithBool:entry_2.b]; - newElement_2.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; - newElement_2.d = [NSData dataWithBytes:entry_2.d.data() length:entry_2.d.size()]; - newElement_2.e = [[NSString alloc] initWithBytes:entry_2.e.data() - length:entry_2.e.size() - encoding:NSUTF8StringEncoding]; - newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; - newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; - newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; - [array_2 addObject:newElement_2]; - } - newElement_0.d = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.e) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; - [array_2 addObject:newElement_2]; - } - newElement_0.e = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.f) { - NSData * newElement_2; - newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; - [array_2 addObject:newElement_2]; - } - newElement_0.f = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.g) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; - [array_2 addObject:newElement_2]; - } - newElement_0.g = array_2; - } - [array_0 addObject:newElement_0]; - } - params.arg1 = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testListNestedStructListArgumentRequestWithParams:params - completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.d) { + MTRUnitTestingClusterSimpleStruct *newElement_2; + newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; + newElement_2.b = [NSNumber numberWithBool:entry_2.b]; + newElement_2.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; + newElement_2.d = [NSData dataWithBytes:entry_2.d.data() + length:entry_2.d.size()]; + newElement_2.e = + [[NSString alloc] initWithBytes:entry_2.e.data() + length:entry_2.e.size() + encoding:NSUTF8StringEncoding]; + newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; + newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; + newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; + [array_2 addObject:newElement_2]; + } + newElement_0.d = array_2; } - return CHIP_NO_ERROR; + { // Scope for our temporary variables + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.e) { + NSNumber *newElement_2; + newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; + [array_2 addObject:newElement_2]; + } + newElement_0.e = array_2; + } + { // Scope for our temporary variables + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.f) { + NSData *newElement_2; + newElement_2 = [NSData dataWithBytes:entry_2.data() + length:entry_2.size()]; + [array_2 addObject:newElement_2]; + } + newElement_0.f = array_2; + } + { // Scope for our temporary variables + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.g) { + NSNumber *newElement_2; + newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; + [array_2 addObject:newElement_2]; + } + newElement_0.g = array_2; + } + [array_0 addObject:newElement_0]; + } + params.arg1 = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testListNestedStructListArgumentRequestWithParams:params + completion:^( + MTRUnitTestingClusterBooleanResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus( + mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type mRequest; - TypedComplexArgument> - mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands:: + TestListNestedStructListArgumentRequest::Type mRequest; + TypedComplexArgument> + mComplex_Arg1; }; /* @@ -87098,58 +102752,69 @@ class UnitTestingTestListNestedStructListArgumentRequest : public ClusterCommand */ class UnitTestingTestListInt8UReverseRequest : public ClusterCommand { public: - UnitTestingTestListInt8UReverseRequest() - : ClusterCommand("test-list-int8ureverse-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestListInt8UReverseRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.arg1) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; - [array_0 addObject:newElement_0]; - } - params.arg1 = array_0; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testListInt8UReverseRequestWithParams:params - completion:^(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestListInt8UReverseRequest() + : ClusterCommand("test-list-int8ureverse-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000D) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestListInt8UReverseRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mRequest.arg1) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + params.arg1 = array_0; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testListInt8UReverseRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestListInt8UReverseResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type mRequest; - TypedComplexArgument> mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type + mRequest; + TypedComplexArgument> mComplex_Arg1; }; /* @@ -87157,49 +102822,60 @@ class UnitTestingTestListInt8UReverseRequest : public ClusterCommand { */ class UnitTestingTestEnumsRequest : public ClusterCommand { public: - UnitTestingTestEnumsRequest() - : ClusterCommand("test-enums-request") - { - AddArgument("Arg1", 0, UINT16_MAX, &mRequest.arg1); - AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestEnumsRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.arg1)]; - params.arg2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testEnumsRequestWithParams:params - completion:^(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestEnumsRequest() : ClusterCommand("test-enums-request") { + AddArgument("Arg1", 0, UINT16_MAX, &mRequest.arg1); + AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000E) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestEnumsRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = + [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.arg1)]; + params.arg2 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster testEnumsRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestEnumsResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type mRequest; }; /* @@ -87207,56 +102883,68 @@ class UnitTestingTestEnumsRequest : public ClusterCommand { */ class UnitTestingTestNullableOptionalRequest : public ClusterCommand { public: - UnitTestingTestNullableOptionalRequest() - : ClusterCommand("test-nullable-optional-request") - { - AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestNullableOptionalRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.arg1.HasValue()) { - if (mRequest.arg1.Value().IsNull()) { - params.arg1 = nil; - } else { - params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1.Value().Value()]; - } - } else { - params.arg1 = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testNullableOptionalRequestWithParams:params - completion:^(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestNullableOptionalRequest() + : ClusterCommand("test-nullable-optional-request") { + AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x0000000F) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestNullableOptionalRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.arg1.HasValue()) { + if (mRequest.arg1.Value().IsNull()) { + params.arg1 = nil; + } else { + params.arg1 = + [NSNumber numberWithUnsignedChar:mRequest.arg1.Value().Value()]; + } + } else { + params.arg1 = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testNullableOptionalRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestNullableOptionalResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type + mRequest; }; /* @@ -87264,223 +102952,287 @@ class UnitTestingTestNullableOptionalRequest : public ClusterCommand { */ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { public: - UnitTestingTestComplexNullableOptionalRequest() - : ClusterCommand("test-complex-nullable-optional-request") - , mComplex_NullableStruct(&mRequest.nullableStruct) - , mComplex_OptionalStruct(&mRequest.optionalStruct) - , mComplex_NullableOptionalStruct(&mRequest.nullableOptionalStruct) - , mComplex_NullableList(&mRequest.nullableList) - , mComplex_OptionalList(&mRequest.optionalList) - , mComplex_NullableOptionalList(&mRequest.nullableOptionalList) - { - AddArgument("NullableInt", 0, UINT16_MAX, &mRequest.nullableInt); - AddArgument("OptionalInt", 0, UINT16_MAX, &mRequest.optionalInt); - AddArgument("NullableOptionalInt", 0, UINT16_MAX, &mRequest.nullableOptionalInt); - AddArgument("NullableString", &mRequest.nullableString); - AddArgument("OptionalString", &mRequest.optionalString); - AddArgument("NullableOptionalString", &mRequest.nullableOptionalString); - AddArgument("NullableStruct", &mComplex_NullableStruct); - AddArgument("OptionalStruct", &mComplex_OptionalStruct); - AddArgument("NullableOptionalStruct", &mComplex_NullableOptionalStruct); - AddArgument("NullableList", &mComplex_NullableList); - AddArgument("OptionalList", &mComplex_OptionalList); - AddArgument("NullableOptionalList", &mComplex_NullableOptionalList); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.nullableInt.IsNull()) { - params.nullableInt = nil; - } else { - params.nullableInt = [NSNumber numberWithUnsignedShort:mRequest.nullableInt.Value()]; - } - if (mRequest.optionalInt.HasValue()) { - params.optionalInt = [NSNumber numberWithUnsignedShort:mRequest.optionalInt.Value()]; - } else { - params.optionalInt = nil; - } - if (mRequest.nullableOptionalInt.HasValue()) { - if (mRequest.nullableOptionalInt.Value().IsNull()) { - params.nullableOptionalInt = nil; - } else { - params.nullableOptionalInt = [NSNumber numberWithUnsignedShort:mRequest.nullableOptionalInt.Value().Value()]; - } - } else { - params.nullableOptionalInt = nil; - } - if (mRequest.nullableString.IsNull()) { - params.nullableString = nil; - } else { - params.nullableString = [[NSString alloc] initWithBytes:mRequest.nullableString.Value().data() - length:mRequest.nullableString.Value().size() - encoding:NSUTF8StringEncoding]; - } - if (mRequest.optionalString.HasValue()) { - params.optionalString = [[NSString alloc] initWithBytes:mRequest.optionalString.Value().data() - length:mRequest.optionalString.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - params.optionalString = nil; - } - if (mRequest.nullableOptionalString.HasValue()) { - if (mRequest.nullableOptionalString.Value().IsNull()) { - params.nullableOptionalString = nil; - } else { - params.nullableOptionalString = - [[NSString alloc] initWithBytes:mRequest.nullableOptionalString.Value().Value().data() - length:mRequest.nullableOptionalString.Value().Value().size() - encoding:NSUTF8StringEncoding]; - } - } else { - params.nullableOptionalString = nil; - } - if (mRequest.nullableStruct.IsNull()) { - params.nullableStruct = nil; - } else { - params.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; - params.nullableStruct.a = [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().a]; - params.nullableStruct.b = [NSNumber numberWithBool:mRequest.nullableStruct.Value().b]; - params.nullableStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableStruct.Value().c)]; - params.nullableStruct.d = [NSData dataWithBytes:mRequest.nullableStruct.Value().d.data() - length:mRequest.nullableStruct.Value().d.size()]; - params.nullableStruct.e = [[NSString alloc] initWithBytes:mRequest.nullableStruct.Value().e.data() - length:mRequest.nullableStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - params.nullableStruct.f = [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().f.Raw()]; - params.nullableStruct.g = [NSNumber numberWithFloat:mRequest.nullableStruct.Value().g]; - params.nullableStruct.h = [NSNumber numberWithDouble:mRequest.nullableStruct.Value().h]; - } - if (mRequest.optionalStruct.HasValue()) { - params.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - params.optionalStruct.a = [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().a]; - params.optionalStruct.b = [NSNumber numberWithBool:mRequest.optionalStruct.Value().b]; - params.optionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.optionalStruct.Value().c)]; - params.optionalStruct.d = [NSData dataWithBytes:mRequest.optionalStruct.Value().d.data() - length:mRequest.optionalStruct.Value().d.size()]; - params.optionalStruct.e = [[NSString alloc] initWithBytes:mRequest.optionalStruct.Value().e.data() - length:mRequest.optionalStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - params.optionalStruct.f = [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().f.Raw()]; - params.optionalStruct.g = [NSNumber numberWithFloat:mRequest.optionalStruct.Value().g]; - params.optionalStruct.h = [NSNumber numberWithDouble:mRequest.optionalStruct.Value().h]; - } else { - params.optionalStruct = nil; - } - if (mRequest.nullableOptionalStruct.HasValue()) { - if (mRequest.nullableOptionalStruct.Value().IsNull()) { - params.nullableOptionalStruct = nil; - } else { - params.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - params.nullableOptionalStruct.a = - [NSNumber numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value().Value().a]; - params.nullableOptionalStruct.b = [NSNumber numberWithBool:mRequest.nullableOptionalStruct.Value().Value().b]; - params.nullableOptionalStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableOptionalStruct.Value().Value().c)]; - params.nullableOptionalStruct.d = [NSData dataWithBytes:mRequest.nullableOptionalStruct.Value().Value().d.data() - length:mRequest.nullableOptionalStruct.Value().Value().d.size()]; - params.nullableOptionalStruct.e = - [[NSString alloc] initWithBytes:mRequest.nullableOptionalStruct.Value().Value().e.data() - length:mRequest.nullableOptionalStruct.Value().Value().e.size() - encoding:NSUTF8StringEncoding]; - params.nullableOptionalStruct.f = - [NSNumber numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value().Value().f.Raw()]; - params.nullableOptionalStruct.g = [NSNumber numberWithFloat:mRequest.nullableOptionalStruct.Value().Value().g]; - params.nullableOptionalStruct.h = [NSNumber numberWithDouble:mRequest.nullableOptionalStruct.Value().Value().h]; - } - } else { - params.nullableOptionalStruct = nil; - } - if (mRequest.nullableList.IsNull()) { - params.nullableList = nil; - } else { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.nullableList.Value()) { - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; - [array_1 addObject:newElement_1]; - } - params.nullableList = array_1; - } - } - if (mRequest.optionalList.HasValue()) { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.optionalList.Value()) { - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; - [array_1 addObject:newElement_1]; - } - params.optionalList = array_1; - } - } else { - params.optionalList = nil; - } - if (mRequest.nullableOptionalList.HasValue()) { - if (mRequest.nullableOptionalList.Value().IsNull()) { - params.nullableOptionalList = nil; - } else { - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : mRequest.nullableOptionalList.Value().Value()) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2)]; - [array_2 addObject:newElement_2]; - } - params.nullableOptionalList = array_2; - } - } - } else { - params.nullableOptionalList = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testComplexNullableOptionalRequestWithParams:params - completion:^( - MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestComplexNullableOptionalRequest() + : ClusterCommand("test-complex-nullable-optional-request"), + mComplex_NullableStruct(&mRequest.nullableStruct), + mComplex_OptionalStruct(&mRequest.optionalStruct), + mComplex_NullableOptionalStruct(&mRequest.nullableOptionalStruct), + mComplex_NullableList(&mRequest.nullableList), + mComplex_OptionalList(&mRequest.optionalList), + mComplex_NullableOptionalList(&mRequest.nullableOptionalList) { + AddArgument("NullableInt", 0, UINT16_MAX, &mRequest.nullableInt); + AddArgument("OptionalInt", 0, UINT16_MAX, &mRequest.optionalInt); + AddArgument("NullableOptionalInt", 0, UINT16_MAX, + &mRequest.nullableOptionalInt); + AddArgument("NullableString", &mRequest.nullableString); + AddArgument("OptionalString", &mRequest.optionalString); + AddArgument("NullableOptionalString", &mRequest.nullableOptionalString); + AddArgument("NullableStruct", &mComplex_NullableStruct); + AddArgument("OptionalStruct", &mComplex_OptionalStruct); + AddArgument("NullableOptionalStruct", &mComplex_NullableOptionalStruct); + AddArgument("NullableList", &mComplex_NullableList); + AddArgument("OptionalList", &mComplex_OptionalList); + AddArgument("NullableOptionalList", &mComplex_NullableOptionalList); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000010) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.nullableInt.IsNull()) { + params.nullableInt = nil; + } else { + params.nullableInt = + [NSNumber numberWithUnsignedShort:mRequest.nullableInt.Value()]; + } + if (mRequest.optionalInt.HasValue()) { + params.optionalInt = + [NSNumber numberWithUnsignedShort:mRequest.optionalInt.Value()]; + } else { + params.optionalInt = nil; + } + if (mRequest.nullableOptionalInt.HasValue()) { + if (mRequest.nullableOptionalInt.Value().IsNull()) { + params.nullableOptionalInt = nil; + } else { + params.nullableOptionalInt = [NSNumber + numberWithUnsignedShort:mRequest.nullableOptionalInt.Value() + .Value()]; + } + } else { + params.nullableOptionalInt = nil; + } + if (mRequest.nullableString.IsNull()) { + params.nullableString = nil; + } else { + params.nullableString = + [[NSString alloc] initWithBytes:mRequest.nullableString.Value().data() + length:mRequest.nullableString.Value().size() + encoding:NSUTF8StringEncoding]; + } + if (mRequest.optionalString.HasValue()) { + params.optionalString = + [[NSString alloc] initWithBytes:mRequest.optionalString.Value().data() + length:mRequest.optionalString.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + params.optionalString = nil; + } + if (mRequest.nullableOptionalString.HasValue()) { + if (mRequest.nullableOptionalString.Value().IsNull()) { + params.nullableOptionalString = nil; + } else { + params.nullableOptionalString = [[NSString alloc] + initWithBytes:mRequest.nullableOptionalString.Value().Value().data() + length:mRequest.nullableOptionalString.Value().Value().size() + encoding:NSUTF8StringEncoding]; + } + } else { + params.nullableOptionalString = nil; + } + if (mRequest.nullableStruct.IsNull()) { + params.nullableStruct = nil; + } else { + params.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; + params.nullableStruct.a = + [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().a]; + params.nullableStruct.b = + [NSNumber numberWithBool:mRequest.nullableStruct.Value().b]; + params.nullableStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.nullableStruct.Value().c)]; + params.nullableStruct.d = + [NSData dataWithBytes:mRequest.nullableStruct.Value().d.data() + length:mRequest.nullableStruct.Value().d.size()]; + params.nullableStruct.e = [[NSString alloc] + initWithBytes:mRequest.nullableStruct.Value().e.data() + length:mRequest.nullableStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + params.nullableStruct.f = [NSNumber + numberWithUnsignedChar:mRequest.nullableStruct.Value().f.Raw()]; + params.nullableStruct.g = + [NSNumber numberWithFloat:mRequest.nullableStruct.Value().g]; + params.nullableStruct.h = + [NSNumber numberWithDouble:mRequest.nullableStruct.Value().h]; + } + if (mRequest.optionalStruct.HasValue()) { + params.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + params.optionalStruct.a = + [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().a]; + params.optionalStruct.b = + [NSNumber numberWithBool:mRequest.optionalStruct.Value().b]; + params.optionalStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.optionalStruct.Value().c)]; + params.optionalStruct.d = + [NSData dataWithBytes:mRequest.optionalStruct.Value().d.data() + length:mRequest.optionalStruct.Value().d.size()]; + params.optionalStruct.e = [[NSString alloc] + initWithBytes:mRequest.optionalStruct.Value().e.data() + length:mRequest.optionalStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + params.optionalStruct.f = [NSNumber + numberWithUnsignedChar:mRequest.optionalStruct.Value().f.Raw()]; + params.optionalStruct.g = + [NSNumber numberWithFloat:mRequest.optionalStruct.Value().g]; + params.optionalStruct.h = + [NSNumber numberWithDouble:mRequest.optionalStruct.Value().h]; + } else { + params.optionalStruct = nil; + } + if (mRequest.nullableOptionalStruct.HasValue()) { + if (mRequest.nullableOptionalStruct.Value().IsNull()) { + params.nullableOptionalStruct = nil; + } else { + params.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + params.nullableOptionalStruct.a = [NSNumber + numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value() + .Value() + .a]; + params.nullableOptionalStruct.b = [NSNumber + numberWithBool:mRequest.nullableOptionalStruct.Value().Value().b]; + params.nullableOptionalStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + mRequest.nullableOptionalStruct.Value() + .Value() + .c)]; + params.nullableOptionalStruct.d = + [NSData dataWithBytes:mRequest.nullableOptionalStruct.Value() + .Value() + .d.data() + length:mRequest.nullableOptionalStruct.Value() + .Value() + .d.size()]; + params.nullableOptionalStruct.e = [[NSString alloc] + initWithBytes:mRequest.nullableOptionalStruct.Value() + .Value() + .e.data() + length:mRequest.nullableOptionalStruct.Value() + .Value() + .e.size() + encoding:NSUTF8StringEncoding]; + params.nullableOptionalStruct.f = [NSNumber + numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value() + .Value() + .f.Raw()]; + params.nullableOptionalStruct.g = [NSNumber + numberWithFloat:mRequest.nullableOptionalStruct.Value().Value().g]; + params.nullableOptionalStruct.h = [NSNumber + numberWithDouble:mRequest.nullableOptionalStruct.Value().Value().h]; + } + } else { + params.nullableOptionalStruct = nil; + } + if (mRequest.nullableList.IsNull()) { + params.nullableList = nil; + } else { + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.nullableList.Value()) { + NSNumber *newElement_1; + newElement_1 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; + [array_1 addObject:newElement_1]; + } + params.nullableList = array_1; + } + } + if (mRequest.optionalList.HasValue()) { + { // Scope for our temporary variables + auto *array_1 = [NSMutableArray new]; + for (auto &entry_1 : mRequest.optionalList.Value()) { + NSNumber *newElement_1; + newElement_1 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; + [array_1 addObject:newElement_1]; + } + params.optionalList = array_1; + } + } else { + params.optionalList = nil; + } + if (mRequest.nullableOptionalList.HasValue()) { + if (mRequest.nullableOptionalList.Value().IsNull()) { + params.nullableOptionalList = nil; + } else { + { // Scope for our temporary variables + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : mRequest.nullableOptionalList.Value().Value()) { + NSNumber *newElement_2; + newElement_2 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2)]; + [array_2 addObject:newElement_2]; + } + params.nullableOptionalList = array_2; + } + } + } else { + params.nullableOptionalList = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testComplexNullableOptionalRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestComplexNullableOptionalResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Type mRequest; - TypedComplexArgument> - mComplex_NullableStruct; - TypedComplexArgument> mComplex_OptionalStruct; - TypedComplexArgument< - chip::Optional>> - mComplex_NullableOptionalStruct; - TypedComplexArgument< - chip::app::DataModel::Nullable>> - mComplex_NullableList; - TypedComplexArgument>> - mComplex_OptionalList; - TypedComplexArgument>>> - mComplex_NullableOptionalList; + chip::app::Clusters::UnitTesting::Commands:: + TestComplexNullableOptionalRequest::Type mRequest; + TypedComplexArgument> + mComplex_NullableStruct; + TypedComplexArgument> + mComplex_OptionalStruct; + TypedComplexArgument>> + mComplex_NullableOptionalStruct; + TypedComplexArgument< + chip::app::DataModel::Nullable>> + mComplex_NullableList; + TypedComplexArgument>> + mComplex_OptionalList; + TypedComplexArgument< + chip::Optional>>> + mComplex_NullableOptionalList; }; /* @@ -87488,59 +103240,75 @@ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { */ class UnitTestingSimpleStructEchoRequest : public ClusterCommand { public: - UnitTestingSimpleStructEchoRequest() - : ClusterCommand("simple-struct-echo-request") - , mComplex_Arg1(&mRequest.arg1) - { - AddArgument("Arg1", &mComplex_Arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterSimpleStructEchoRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; - params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; - params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; - params.arg1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; - params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() length:mRequest.arg1.d.size()]; - params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() - length:mRequest.arg1.e.size() - encoding:NSUTF8StringEncoding]; - params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; - params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; - params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster simpleStructEchoRequestWithParams:params - completion:^(MTRUnitTestingClusterSimpleStructResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingSimpleStructEchoRequest() + : ClusterCommand("simple-struct-echo-request"), + mComplex_Arg1(&mRequest.arg1) { + AddArgument("Arg1", &mComplex_Arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000011) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterSimpleStructEchoRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; + params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; + params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; + params.arg1.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; + params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() + length:mRequest.arg1.d.size()]; + params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() + length:mRequest.arg1.e.size() + encoding:NSUTF8StringEncoding]; + params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; + params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; + params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + simpleStructEchoRequestWithParams:params + completion:^( + MTRUnitTestingClusterSimpleStructResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Type mRequest; - TypedComplexArgument mComplex_Arg1; + chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Type + mRequest; + TypedComplexArgument< + chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type> + mComplex_Arg1; }; /* @@ -87548,40 +103316,47 @@ class UnitTestingSimpleStructEchoRequest : public ClusterCommand { */ class UnitTestingTimedInvokeRequest : public ClusterCommand { public: - UnitTestingTimedInvokeRequest() - : ClusterCommand("timed-invoke-request") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTimedInvokeRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster timedInvokeRequestWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTimedInvokeRequest() : ClusterCommand("timed-invoke-request") { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000012) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTimedInvokeRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster timedInvokeRequestWithParams:params + completion:^(NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: }; @@ -87591,49 +103366,61 @@ class UnitTestingTimedInvokeRequest : public ClusterCommand { */ class UnitTestingTestSimpleOptionalArgumentRequest : public ClusterCommand { public: - UnitTestingTestSimpleOptionalArgumentRequest() - : ClusterCommand("test-simple-optional-argument-request") - { - AddArgument("Arg1", 0, 1, &mRequest.arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - if (mRequest.arg1.HasValue()) { - params.arg1 = [NSNumber numberWithBool:mRequest.arg1.Value()]; - } else { - params.arg1 = nil; - } - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testSimpleOptionalArgumentRequestWithParams:params - completion:^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestSimpleOptionalArgumentRequest() + : ClusterCommand("test-simple-optional-argument-request") { + AddArgument("Arg1", 0, 1, &mRequest.arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000013) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + if (mRequest.arg1.HasValue()) { + params.arg1 = [NSNumber numberWithBool:mRequest.arg1.Value()]; + } else { + params.arg1 = nil; + } + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testSimpleOptionalArgumentRequestWithParams:params + completion:^( + NSError *_Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands:: + TestSimpleOptionalArgumentRequest::Type mRequest; }; /* @@ -87641,51 +103428,64 @@ class UnitTestingTestSimpleOptionalArgumentRequest : public ClusterCommand { */ class UnitTestingTestEmitTestEventRequest : public ClusterCommand { public: - UnitTestingTestEmitTestEventRequest() - : ClusterCommand("test-emit-test-event-request") - { - AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); - AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); - AddArgument("Arg3", 0, 1, &mRequest.arg3); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestEmitTestEventRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; - params.arg2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; - params.arg3 = [NSNumber numberWithBool:mRequest.arg3]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster testEmitTestEventRequestWithParams:params - completion:^(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestEmitTestEventRequest() + : ClusterCommand("test-emit-test-event-request") { + AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); + AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); + AddArgument("Arg3", 0, 1, &mRequest.arg3); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000014) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestEmitTestEventRequestParams alloc] init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; + params.arg2 = + [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; + params.arg3 = [NSNumber numberWithBool:mRequest.arg3]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testEmitTestEventRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestEmitTestEventResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type + mRequest; }; /* @@ -87693,49 +103493,60 @@ class UnitTestingTestEmitTestEventRequest : public ClusterCommand { */ class UnitTestingTestEmitTestFabricScopedEventRequest : public ClusterCommand { public: - UnitTestingTestEmitTestFabricScopedEventRequest() - : ClusterCommand("test-emit-test-fabric-scoped-event-request") - { - AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) command (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams alloc] init]; - params.timedInvokeTimeoutMs - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster - testEmitTestFabricScopedEventRequestWithParams:params - completion:^( - MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable values, - NSError * _Nullable error) { - NSLog(@"Values: %@", values); - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; + UnitTestingTestEmitTestFabricScopedEventRequest() + : ClusterCommand("test-emit-test-fabric-scoped-event-request") { + AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress( + chipTool, + "Sending cluster (0xFFF1FC05) command (0x00000015) on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams alloc] + init]; + params.timedInvokeTimeoutMs = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster + testEmitTestFabricScopedEventRequestWithParams:params + completion:^( + MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams + *_Nullable values, + NSError *_Nullable error) { + NSLog(@"Values: %@", values); + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Type mRequest; + chip::app::Clusters::UnitTesting::Commands:: + TestEmitTestFabricScopedEventRequest::Type mRequest; }; /* @@ -87743,109 +103554,127 @@ class UnitTestingTestEmitTestFabricScopedEventRequest : public ClusterCommand { */ class ReadUnitTestingBoolean : public ReadAttribute { public: - ReadUnitTestingBoolean() - : ReadAttribute("boolean") - { - } - - ~ReadUnitTestingBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Boolean response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Boolean read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingBoolean() : ReadAttribute("boolean") {} + + ~ReadUnitTestingBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBooleanWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Boolean response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Boolean read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingBoolean : public WriteAttribute { public: - WriteUnitTestingBoolean() - : WriteAttribute("boolean") - { - AddArgument("attr-name", "boolean"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeBooleanWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Boolean write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingBoolean() : WriteAttribute("boolean") { + AddArgument("attr-name", "boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeBooleanWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Boolean write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; class SubscribeAttributeUnitTestingBoolean : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingBoolean() - : SubscribeAttribute("boolean") - { - } + SubscribeAttributeUnitTestingBoolean() : SubscribeAttribute("boolean") {} - ~SubscribeAttributeUnitTestingBoolean() {} + ~SubscribeAttributeUnitTestingBoolean() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBooleanWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBooleanWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Boolean response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Boolean response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -87853,109 +103682,127 @@ class SubscribeAttributeUnitTestingBoolean : public SubscribeAttribute { */ class ReadUnitTestingBitmap8 : public ReadAttribute { public: - ReadUnitTestingBitmap8() - : ReadAttribute("bitmap8") - { - } - - ~ReadUnitTestingBitmap8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBitmap8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Bitmap8 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingBitmap8() : ReadAttribute("bitmap8") {} + + ~ReadUnitTestingBitmap8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBitmap8WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Bitmap8 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingBitmap8 : public WriteAttribute { public: - WriteUnitTestingBitmap8() - : WriteAttribute("bitmap8") - { - AddArgument("attr-name", "bitmap8"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingBitmap8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeBitmap8WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Bitmap8 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingBitmap8() : WriteAttribute("bitmap8") { + AddArgument("attr-name", "bitmap8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingBitmap8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeBitmap8WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Bitmap8 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingBitmap8 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingBitmap8() - : SubscribeAttribute("bitmap8") - { - } + SubscribeAttributeUnitTestingBitmap8() : SubscribeAttribute("bitmap8") {} - ~SubscribeAttributeUnitTestingBitmap8() {} + ~SubscribeAttributeUnitTestingBitmap8() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBitmap8WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBitmap8WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -87963,219 +103810,255 @@ class SubscribeAttributeUnitTestingBitmap8 : public SubscribeAttribute { */ class ReadUnitTestingBitmap16 : public ReadAttribute { public: - ReadUnitTestingBitmap16() - : ReadAttribute("bitmap16") - { - } - - ~ReadUnitTestingBitmap16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBitmap16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Bitmap16 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingBitmap16() : ReadAttribute("bitmap16") {} + + ~ReadUnitTestingBitmap16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBitmap16WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Bitmap16 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingBitmap16 : public WriteAttribute { public: - WriteUnitTestingBitmap16() - : WriteAttribute("bitmap16") - { - AddArgument("attr-name", "bitmap16"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingBitmap16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeBitmap16WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Bitmap16 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingBitmap16() : WriteAttribute("bitmap16") { + AddArgument("attr-name", "bitmap16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingBitmap16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeBitmap16WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Bitmap16 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeUnitTestingBitmap16 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingBitmap16() - : SubscribeAttribute("bitmap16") - { - } + SubscribeAttributeUnitTestingBitmap16() : SubscribeAttribute("bitmap16") {} - ~SubscribeAttributeUnitTestingBitmap16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeBitmap16WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeUnitTestingBitmap16() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -/* - * Attribute Bitmap32 - */ -class ReadUnitTestingBitmap32 : public ReadAttribute { -public: - ReadUnitTestingBitmap32() - : ReadAttribute("bitmap32") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~ReadUnitTestingBitmap32() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBitmap32WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Bitmap32 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeBitmap16WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute Bitmap32 + */ +class ReadUnitTestingBitmap32 : public ReadAttribute { +public: + ReadUnitTestingBitmap32() : ReadAttribute("bitmap32") {} + + ~ReadUnitTestingBitmap32() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBitmap32WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Bitmap32 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingBitmap32 : public WriteAttribute { public: - WriteUnitTestingBitmap32() - : WriteAttribute("bitmap32") - { - AddArgument("attr-name", "bitmap32"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingBitmap32() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeBitmap32WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Bitmap32 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingBitmap32() : WriteAttribute("bitmap32") { + AddArgument("attr-name", "bitmap32"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingBitmap32() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeBitmap32WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Bitmap32 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingBitmap32 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingBitmap32() - : SubscribeAttribute("bitmap32") - { - } + SubscribeAttributeUnitTestingBitmap32() : SubscribeAttribute("bitmap32") {} - ~SubscribeAttributeUnitTestingBitmap32() {} + ~SubscribeAttributeUnitTestingBitmap32() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBitmap32WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBitmap32WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88183,109 +104066,127 @@ class SubscribeAttributeUnitTestingBitmap32 : public SubscribeAttribute { */ class ReadUnitTestingBitmap64 : public ReadAttribute { public: - ReadUnitTestingBitmap64() - : ReadAttribute("bitmap64") - { - } - - ~ReadUnitTestingBitmap64() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeBitmap64WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Bitmap64 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingBitmap64() : ReadAttribute("bitmap64") {} + + ~ReadUnitTestingBitmap64() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeBitmap64WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Bitmap64 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingBitmap64 : public WriteAttribute { public: - WriteUnitTestingBitmap64() - : WriteAttribute("bitmap64") - { - AddArgument("attr-name", "bitmap64"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingBitmap64() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeBitmap64WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Bitmap64 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingBitmap64() : WriteAttribute("bitmap64") { + AddArgument("attr-name", "bitmap64"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingBitmap64() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeBitmap64WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Bitmap64 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingBitmap64 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingBitmap64() - : SubscribeAttribute("bitmap64") - { - } + SubscribeAttributeUnitTestingBitmap64() : SubscribeAttribute("bitmap64") {} - ~SubscribeAttributeUnitTestingBitmap64() {} + ~SubscribeAttributeUnitTestingBitmap64() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBitmap64WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeBitmap64WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88293,109 +104194,126 @@ class SubscribeAttributeUnitTestingBitmap64 : public SubscribeAttribute { */ class ReadUnitTestingInt8u : public ReadAttribute { public: - ReadUnitTestingInt8u() - : ReadAttribute("int8u") - { - } - - ~ReadUnitTestingInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt8u() : ReadAttribute("int8u") {} + + ~ReadUnitTestingInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt8uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int8u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int8u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt8u : public WriteAttribute { public: - WriteUnitTestingInt8u() - : WriteAttribute("int8u") - { - AddArgument("attr-name", "int8u"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int8u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt8u() : WriteAttribute("int8u") { + AddArgument("attr-name", "int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeInt8uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int8u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingInt8u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt8u() - : SubscribeAttribute("int8u") - { - } + SubscribeAttributeUnitTestingInt8u() : SubscribeAttribute("int8u") {} - ~SubscribeAttributeUnitTestingInt8u() {} + ~SubscribeAttributeUnitTestingInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int8u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88403,109 +104321,126 @@ class SubscribeAttributeUnitTestingInt8u : public SubscribeAttribute { */ class ReadUnitTestingInt16u : public ReadAttribute { public: - ReadUnitTestingInt16u() - : ReadAttribute("int16u") - { - } - - ~ReadUnitTestingInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int16u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int16u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt16u() : ReadAttribute("int16u") {} + + ~ReadUnitTestingInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt16uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int16u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int16u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt16u : public WriteAttribute { public: - WriteUnitTestingInt16u() - : WriteAttribute("int16u") - { - AddArgument("attr-name", "int16u"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeInt16uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int16u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt16u() : WriteAttribute("int16u") { + AddArgument("attr-name", "int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeInt16uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int16u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeUnitTestingInt16u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt16u() - : SubscribeAttribute("int16u") - { - } + SubscribeAttributeUnitTestingInt16u() : SubscribeAttribute("int16u") {} - ~SubscribeAttributeUnitTestingInt16u() {} + ~SubscribeAttributeUnitTestingInt16u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt16uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt16uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int16u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int16u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88513,109 +104448,126 @@ class SubscribeAttributeUnitTestingInt16u : public SubscribeAttribute { */ class ReadUnitTestingInt24u : public ReadAttribute { public: - ReadUnitTestingInt24u() - : ReadAttribute("int24u") - { - } - - ~ReadUnitTestingInt24u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt24uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int24u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int24u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt24u() : ReadAttribute("int24u") {} + + ~ReadUnitTestingInt24u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt24uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int24u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int24u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt24u : public WriteAttribute { public: - WriteUnitTestingInt24u() - : WriteAttribute("int24u") - { - AddArgument("attr-name", "int24u"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt24u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeInt24uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int24u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt24u() : WriteAttribute("int24u") { + AddArgument("attr-name", "int24u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt24u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster writeAttributeInt24uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int24u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingInt24u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt24u() - : SubscribeAttribute("int24u") - { - } + SubscribeAttributeUnitTestingInt24u() : SubscribeAttribute("int24u") {} - ~SubscribeAttributeUnitTestingInt24u() {} + ~SubscribeAttributeUnitTestingInt24u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt24uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt24uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int24u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int24u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88623,109 +104575,126 @@ class SubscribeAttributeUnitTestingInt24u : public SubscribeAttribute { */ class ReadUnitTestingInt32u : public ReadAttribute { public: - ReadUnitTestingInt32u() - : ReadAttribute("int32u") - { - } - - ~ReadUnitTestingInt32u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt32uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int32u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int32u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt32u() : ReadAttribute("int32u") {} + + ~ReadUnitTestingInt32u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt32uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int32u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int32u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt32u : public WriteAttribute { public: - WriteUnitTestingInt32u() - : WriteAttribute("int32u") - { - AddArgument("attr-name", "int32u"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt32u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeInt32uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int32u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt32u() : WriteAttribute("int32u") { + AddArgument("attr-name", "int32u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt32u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster writeAttributeInt32uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int32u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingInt32u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt32u() - : SubscribeAttribute("int32u") - { - } + SubscribeAttributeUnitTestingInt32u() : SubscribeAttribute("int32u") {} - ~SubscribeAttributeUnitTestingInt32u() {} + ~SubscribeAttributeUnitTestingInt32u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt32uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt32uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int32u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int32u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88733,109 +104702,126 @@ class SubscribeAttributeUnitTestingInt32u : public SubscribeAttribute { */ class ReadUnitTestingInt40u : public ReadAttribute { public: - ReadUnitTestingInt40u() - : ReadAttribute("int40u") - { - } - - ~ReadUnitTestingInt40u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt40uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int40u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int40u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt40u() : ReadAttribute("int40u") {} + + ~ReadUnitTestingInt40u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt40uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int40u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int40u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt40u : public WriteAttribute { public: - WriteUnitTestingInt40u() - : WriteAttribute("int40u") - { - AddArgument("attr-name", "int40u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt40u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeInt40uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int40u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt40u() : WriteAttribute("int40u") { + AddArgument("attr-name", "int40u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt40u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster writeAttributeInt40uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int40u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingInt40u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt40u() - : SubscribeAttribute("int40u") - { - } + SubscribeAttributeUnitTestingInt40u() : SubscribeAttribute("int40u") {} - ~SubscribeAttributeUnitTestingInt40u() {} + ~SubscribeAttributeUnitTestingInt40u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt40uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt40uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int40u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int40u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88843,109 +104829,126 @@ class SubscribeAttributeUnitTestingInt40u : public SubscribeAttribute { */ class ReadUnitTestingInt48u : public ReadAttribute { public: - ReadUnitTestingInt48u() - : ReadAttribute("int48u") - { - } - - ~ReadUnitTestingInt48u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt48uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int48u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int48u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt48u() : ReadAttribute("int48u") {} + + ~ReadUnitTestingInt48u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt48uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int48u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int48u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt48u : public WriteAttribute { public: - WriteUnitTestingInt48u() - : WriteAttribute("int48u") - { - AddArgument("attr-name", "int48u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt48u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeInt48uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int48u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt48u() : WriteAttribute("int48u") { + AddArgument("attr-name", "int48u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt48u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster writeAttributeInt48uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int48u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingInt48u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt48u() - : SubscribeAttribute("int48u") - { - } + SubscribeAttributeUnitTestingInt48u() : SubscribeAttribute("int48u") {} - ~SubscribeAttributeUnitTestingInt48u() {} + ~SubscribeAttributeUnitTestingInt48u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt48uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt48uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int48u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int48u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -88953,109 +104956,126 @@ class SubscribeAttributeUnitTestingInt48u : public SubscribeAttribute { */ class ReadUnitTestingInt56u : public ReadAttribute { public: - ReadUnitTestingInt56u() - : ReadAttribute("int56u") - { - } - - ~ReadUnitTestingInt56u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt56uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int56u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int56u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt56u() : ReadAttribute("int56u") {} + + ~ReadUnitTestingInt56u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt56uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int56u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int56u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt56u : public WriteAttribute { public: - WriteUnitTestingInt56u() - : WriteAttribute("int56u") - { - AddArgument("attr-name", "int56u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt56u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeInt56uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int56u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt56u() : WriteAttribute("int56u") { + AddArgument("attr-name", "int56u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt56u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster writeAttributeInt56uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int56u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingInt56u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt56u() - : SubscribeAttribute("int56u") - { - } + SubscribeAttributeUnitTestingInt56u() : SubscribeAttribute("int56u") {} - ~SubscribeAttributeUnitTestingInt56u() {} + ~SubscribeAttributeUnitTestingInt56u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt56uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt56uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int56u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int56u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89063,109 +105083,126 @@ class SubscribeAttributeUnitTestingInt56u : public SubscribeAttribute { */ class ReadUnitTestingInt64u : public ReadAttribute { public: - ReadUnitTestingInt64u() - : ReadAttribute("int64u") - { - } - - ~ReadUnitTestingInt64u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt64uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int64u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int64u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt64u() : ReadAttribute("int64u") {} + + ~ReadUnitTestingInt64u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt64uWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int64u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int64u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt64u : public WriteAttribute { public: - WriteUnitTestingInt64u() - : WriteAttribute("int64u") - { - AddArgument("attr-name", "int64u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt64u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeInt64uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int64u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt64u() : WriteAttribute("int64u") { + AddArgument("attr-name", "int64u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt64u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster writeAttributeInt64uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int64u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingInt64u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt64u() - : SubscribeAttribute("int64u") - { - } + SubscribeAttributeUnitTestingInt64u() : SubscribeAttribute("int64u") {} - ~SubscribeAttributeUnitTestingInt64u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeInt64uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int64u response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeUnitTestingInt64u() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt64uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int64u response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -89173,109 +105210,126 @@ class SubscribeAttributeUnitTestingInt64u : public SubscribeAttribute { */ class ReadUnitTestingInt8s : public ReadAttribute { public: - ReadUnitTestingInt8s() - : ReadAttribute("int8s") - { - } - - ~ReadUnitTestingInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int8s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int8s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt8s() : ReadAttribute("int8s") {} + + ~ReadUnitTestingInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt8sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int8s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int8s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt8s : public WriteAttribute { public: - WriteUnitTestingInt8s() - : WriteAttribute("int8s") - { - AddArgument("attr-name", "int8s"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; - - [cluster writeAttributeInt8sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int8s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt8s() : WriteAttribute("int8s") { + AddArgument("attr-name", "int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithChar:mValue]; + + [cluster writeAttributeInt8sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int8s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int8_t mValue; + int8_t mValue; }; class SubscribeAttributeUnitTestingInt8s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt8s() - : SubscribeAttribute("int8s") - { - } + SubscribeAttributeUnitTestingInt8s() : SubscribeAttribute("int8s") {} - ~SubscribeAttributeUnitTestingInt8s() {} + ~SubscribeAttributeUnitTestingInt8s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt8sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt8sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int8s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int8s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89283,109 +105337,126 @@ class SubscribeAttributeUnitTestingInt8s : public SubscribeAttribute { */ class ReadUnitTestingInt16s : public ReadAttribute { public: - ReadUnitTestingInt16s() - : ReadAttribute("int16s") - { - } - - ~ReadUnitTestingInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int16s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int16s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt16s() : ReadAttribute("int16s") {} + + ~ReadUnitTestingInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt16sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int16s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int16s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt16s : public WriteAttribute { public: - WriteUnitTestingInt16s() - : WriteAttribute("int16s") - { - AddArgument("attr-name", "int16s"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeInt16sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int16s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt16s() : WriteAttribute("int16s") { + AddArgument("attr-name", "int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster writeAttributeInt16sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int16s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int16_t mValue; + int16_t mValue; }; class SubscribeAttributeUnitTestingInt16s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt16s() - : SubscribeAttribute("int16s") - { - } + SubscribeAttributeUnitTestingInt16s() : SubscribeAttribute("int16s") {} - ~SubscribeAttributeUnitTestingInt16s() {} + ~SubscribeAttributeUnitTestingInt16s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt16sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt16sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int16s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int16s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89393,109 +105464,126 @@ class SubscribeAttributeUnitTestingInt16s : public SubscribeAttribute { */ class ReadUnitTestingInt24s : public ReadAttribute { public: - ReadUnitTestingInt24s() - : ReadAttribute("int24s") - { - } - - ~ReadUnitTestingInt24s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt24sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int24s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int24s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt24s() : ReadAttribute("int24s") {} + + ~ReadUnitTestingInt24s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt24sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int24s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int24s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt24s : public WriteAttribute { public: - WriteUnitTestingInt24s() - : WriteAttribute("int24s") - { - AddArgument("attr-name", "int24s"); - AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt24s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithInt:mValue]; - - [cluster writeAttributeInt24sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int24s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt24s() : WriteAttribute("int24s") { + AddArgument("attr-name", "int24s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt24s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithInt:mValue]; + + [cluster writeAttributeInt24sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int24s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int32_t mValue; + int32_t mValue; }; class SubscribeAttributeUnitTestingInt24s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt24s() - : SubscribeAttribute("int24s") - { - } + SubscribeAttributeUnitTestingInt24s() : SubscribeAttribute("int24s") {} - ~SubscribeAttributeUnitTestingInt24s() {} + ~SubscribeAttributeUnitTestingInt24s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000000F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt24sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt24sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int24s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int24s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89503,109 +105591,126 @@ class SubscribeAttributeUnitTestingInt24s : public SubscribeAttribute { */ class ReadUnitTestingInt32s : public ReadAttribute { public: - ReadUnitTestingInt32s() - : ReadAttribute("int32s") - { - } - - ~ReadUnitTestingInt32s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt32sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int32s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int32s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt32s() : ReadAttribute("int32s") {} + + ~ReadUnitTestingInt32s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt32sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int32s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int32s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt32s : public WriteAttribute { public: - WriteUnitTestingInt32s() - : WriteAttribute("int32s") - { - AddArgument("attr-name", "int32s"); - AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt32s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithInt:mValue]; - - [cluster writeAttributeInt32sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int32s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt32s() : WriteAttribute("int32s") { + AddArgument("attr-name", "int32s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt32s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithInt:mValue]; + + [cluster writeAttributeInt32sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int32s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int32_t mValue; + int32_t mValue; }; class SubscribeAttributeUnitTestingInt32s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt32s() - : SubscribeAttribute("int32s") - { - } + SubscribeAttributeUnitTestingInt32s() : SubscribeAttribute("int32s") {} - ~SubscribeAttributeUnitTestingInt32s() {} + ~SubscribeAttributeUnitTestingInt32s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt32sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt32sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int32s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int32s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89613,109 +105718,126 @@ class SubscribeAttributeUnitTestingInt32s : public SubscribeAttribute { */ class ReadUnitTestingInt40s : public ReadAttribute { public: - ReadUnitTestingInt40s() - : ReadAttribute("int40s") - { - } - - ~ReadUnitTestingInt40s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt40sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int40s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int40s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt40s() : ReadAttribute("int40s") {} + + ~ReadUnitTestingInt40s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt40sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int40s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int40s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt40s : public WriteAttribute { public: - WriteUnitTestingInt40s() - : WriteAttribute("int40s") - { - AddArgument("attr-name", "int40s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt40s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeInt40sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int40s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt40s() : WriteAttribute("int40s") { + AddArgument("attr-name", "int40s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt40s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithLongLong:mValue]; + + [cluster writeAttributeInt40sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int40s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingInt40s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt40s() - : SubscribeAttribute("int40s") - { - } + SubscribeAttributeUnitTestingInt40s() : SubscribeAttribute("int40s") {} - ~SubscribeAttributeUnitTestingInt40s() {} + ~SubscribeAttributeUnitTestingInt40s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt40sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt40sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int40s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int40s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89723,109 +105845,126 @@ class SubscribeAttributeUnitTestingInt40s : public SubscribeAttribute { */ class ReadUnitTestingInt48s : public ReadAttribute { public: - ReadUnitTestingInt48s() - : ReadAttribute("int48s") - { - } - - ~ReadUnitTestingInt48s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt48sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int48s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int48s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt48s() : ReadAttribute("int48s") {} + + ~ReadUnitTestingInt48s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt48sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int48s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int48s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt48s : public WriteAttribute { public: - WriteUnitTestingInt48s() - : WriteAttribute("int48s") - { - AddArgument("attr-name", "int48s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt48s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeInt48sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int48s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt48s() : WriteAttribute("int48s") { + AddArgument("attr-name", "int48s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt48s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithLongLong:mValue]; + + [cluster writeAttributeInt48sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int48s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingInt48s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt48s() - : SubscribeAttribute("int48s") - { - } + SubscribeAttributeUnitTestingInt48s() : SubscribeAttribute("int48s") {} - ~SubscribeAttributeUnitTestingInt48s() {} + ~SubscribeAttributeUnitTestingInt48s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt48sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt48sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int48s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int48s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89833,109 +105972,126 @@ class SubscribeAttributeUnitTestingInt48s : public SubscribeAttribute { */ class ReadUnitTestingInt56s : public ReadAttribute { public: - ReadUnitTestingInt56s() - : ReadAttribute("int56s") - { - } - - ~ReadUnitTestingInt56s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt56sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int56s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int56s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt56s() : ReadAttribute("int56s") {} + + ~ReadUnitTestingInt56s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt56sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int56s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int56s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt56s : public WriteAttribute { public: - WriteUnitTestingInt56s() - : WriteAttribute("int56s") - { - AddArgument("attr-name", "int56s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt56s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeInt56sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int56s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt56s() : WriteAttribute("int56s") { + AddArgument("attr-name", "int56s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt56s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithLongLong:mValue]; + + [cluster writeAttributeInt56sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int56s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingInt56s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt56s() - : SubscribeAttribute("int56s") - { - } + SubscribeAttributeUnitTestingInt56s() : SubscribeAttribute("int56s") {} - ~SubscribeAttributeUnitTestingInt56s() {} + ~SubscribeAttributeUnitTestingInt56s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt56sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt56sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int56s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int56s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -89943,109 +106099,126 @@ class SubscribeAttributeUnitTestingInt56s : public SubscribeAttribute { */ class ReadUnitTestingInt64s : public ReadAttribute { public: - ReadUnitTestingInt64s() - : ReadAttribute("int64s") - { - } - - ~ReadUnitTestingInt64s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeInt64sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int64s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Int64s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingInt64s() : ReadAttribute("int64s") {} + + ~ReadUnitTestingInt64s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeInt64sWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Int64s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Int64s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingInt64s : public WriteAttribute { public: - WriteUnitTestingInt64s() - : WriteAttribute("int64s") - { - AddArgument("attr-name", "int64s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingInt64s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeInt64sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Int64s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingInt64s() : WriteAttribute("int64s") { + AddArgument("attr-name", "int64s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingInt64s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithLongLong:mValue]; + + [cluster writeAttributeInt64sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Int64s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingInt64s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingInt64s() - : SubscribeAttribute("int64s") - { - } + SubscribeAttributeUnitTestingInt64s() : SubscribeAttribute("int64s") {} - ~SubscribeAttributeUnitTestingInt64s() {} + ~SubscribeAttributeUnitTestingInt64s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeInt64sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeInt64sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Int64s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Int64s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90053,109 +106226,126 @@ class SubscribeAttributeUnitTestingInt64s : public SubscribeAttribute { */ class ReadUnitTestingEnum8 : public ReadAttribute { public: - ReadUnitTestingEnum8() - : ReadAttribute("enum8") - { - } - - ~ReadUnitTestingEnum8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEnum8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Enum8 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Enum8 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingEnum8() : ReadAttribute("enum8") {} + + ~ReadUnitTestingEnum8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnum8WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Enum8 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Enum8 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingEnum8 : public WriteAttribute { public: - WriteUnitTestingEnum8() - : WriteAttribute("enum8") - { - AddArgument("attr-name", "enum8"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingEnum8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeEnum8WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Enum8 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingEnum8() : WriteAttribute("enum8") { + AddArgument("attr-name", "enum8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingEnum8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeEnum8WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Enum8 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingEnum8 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingEnum8() - : SubscribeAttribute("enum8") - { - } + SubscribeAttributeUnitTestingEnum8() : SubscribeAttribute("enum8") {} - ~SubscribeAttributeUnitTestingEnum8() {} + ~SubscribeAttributeUnitTestingEnum8() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnum8WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeEnum8WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Enum8 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Enum8 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90163,109 +106353,126 @@ class SubscribeAttributeUnitTestingEnum8 : public SubscribeAttribute { */ class ReadUnitTestingEnum16 : public ReadAttribute { public: - ReadUnitTestingEnum16() - : ReadAttribute("enum16") - { - } - - ~ReadUnitTestingEnum16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEnum16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Enum16 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Enum16 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteUnitTestingEnum16 : public WriteAttribute { -public: - WriteUnitTestingEnum16() - : WriteAttribute("enum16") - { - AddArgument("attr-name", "enum16"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingEnum16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeEnum16WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Enum16 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingEnum16() : ReadAttribute("enum16") {} + + ~ReadUnitTestingEnum16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnum16WithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.Enum16 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Enum16 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingEnum16 : public WriteAttribute { +public: + WriteUnitTestingEnum16() : WriteAttribute("enum16") { + AddArgument("attr-name", "enum16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingEnum16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeEnum16WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting Enum16 write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeUnitTestingEnum16 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingEnum16() - : SubscribeAttribute("enum16") - { - } + SubscribeAttributeUnitTestingEnum16() : SubscribeAttribute("enum16") {} - ~SubscribeAttributeUnitTestingEnum16() {} + ~SubscribeAttributeUnitTestingEnum16() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnum16WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeEnum16WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Enum16 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Enum16 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90273,109 +106480,130 @@ class SubscribeAttributeUnitTestingEnum16 : public SubscribeAttribute { */ class ReadUnitTestingFloatSingle : public ReadAttribute { public: - ReadUnitTestingFloatSingle() - : ReadAttribute("float-single") - { - } - - ~ReadUnitTestingFloatSingle() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFloatSingleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FloatSingle response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting FloatSingle read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingFloatSingle() : ReadAttribute("float-single") {} + + ~ReadUnitTestingFloatSingle() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFloatSingleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.FloatSingle response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting FloatSingle read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingFloatSingle : public WriteAttribute { public: - WriteUnitTestingFloatSingle() - : WriteAttribute("float-single") - { - AddArgument("attr-name", "float-single"); - AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingFloatSingle() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithFloat:mValue]; - - [cluster writeAttributeFloatSingleWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting FloatSingle write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingFloatSingle() : WriteAttribute("float-single") { + AddArgument("attr-name", "float-single"); + AddArgument("attr-value", -std::numeric_limits::infinity(), + std::numeric_limits::infinity(), &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingFloatSingle() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithFloat:mValue]; + + [cluster + writeAttributeFloatSingleWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting FloatSingle write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - float mValue; + float mValue; }; class SubscribeAttributeUnitTestingFloatSingle : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingFloatSingle() - : SubscribeAttribute("float-single") - { - } + SubscribeAttributeUnitTestingFloatSingle() + : SubscribeAttribute("float-single") {} - ~SubscribeAttributeUnitTestingFloatSingle() {} + ~SubscribeAttributeUnitTestingFloatSingle() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFloatSingleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFloatSingleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FloatSingle response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.FloatSingle response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90383,109 +106611,130 @@ class SubscribeAttributeUnitTestingFloatSingle : public SubscribeAttribute { */ class ReadUnitTestingFloatDouble : public ReadAttribute { public: - ReadUnitTestingFloatDouble() - : ReadAttribute("float-double") - { - } - - ~ReadUnitTestingFloatDouble() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000018) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFloatDoubleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FloatDouble response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting FloatDouble read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingFloatDouble() : ReadAttribute("float-double") {} + + ~ReadUnitTestingFloatDouble() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFloatDoubleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.FloatDouble response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting FloatDouble read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingFloatDouble : public WriteAttribute { public: - WriteUnitTestingFloatDouble() - : WriteAttribute("float-double") - { - AddArgument("attr-name", "float-double"); - AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingFloatDouble() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithDouble:mValue]; - - [cluster writeAttributeFloatDoubleWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting FloatDouble write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingFloatDouble() : WriteAttribute("float-double") { + AddArgument("attr-name", "float-double"); + AddArgument("attr-value", -std::numeric_limits::infinity(), + std::numeric_limits::infinity(), &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingFloatDouble() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithDouble:mValue]; + + [cluster + writeAttributeFloatDoubleWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting FloatDouble write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - double mValue; + double mValue; }; class SubscribeAttributeUnitTestingFloatDouble : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingFloatDouble() - : SubscribeAttribute("float-double") - { - } + SubscribeAttributeUnitTestingFloatDouble() + : SubscribeAttribute("float-double") {} - ~SubscribeAttributeUnitTestingFloatDouble() {} + ~SubscribeAttributeUnitTestingFloatDouble() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFloatDoubleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFloatDoubleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FloatDouble response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.FloatDouble response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90493,109 +106742,130 @@ class SubscribeAttributeUnitTestingFloatDouble : public SubscribeAttribute { */ class ReadUnitTestingOctetString : public ReadAttribute { public: - ReadUnitTestingOctetString() - : ReadAttribute("octet-string") - { - } - - ~ReadUnitTestingOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.OctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting OctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingOctetString() : ReadAttribute("octet-string") {} + + ~ReadUnitTestingOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeOctetStringWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.OctetString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting OctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingOctetString : public WriteAttribute { public: - WriteUnitTestingOctetString() - : WriteAttribute("octet-string") - { - AddArgument("attr-name", "octet-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSData * _Nonnull value = [[NSData alloc] initWithBytes:mValue.data() length:mValue.size()]; - - [cluster writeAttributeOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting OctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingOctetString() : WriteAttribute("octet-string") { + AddArgument("attr-name", "octet-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSData *_Nonnull value = [[NSData alloc] initWithBytes:mValue.data() + length:mValue.size()]; + + [cluster + writeAttributeOctetStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting OctetString write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingOctetString : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingOctetString() - : SubscribeAttribute("octet-string") - { - } + SubscribeAttributeUnitTestingOctetString() + : SubscribeAttribute("octet-string") {} - ~SubscribeAttributeUnitTestingOctetString() {} + ~SubscribeAttributeUnitTestingOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.OctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.OctetString response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90603,120 +106873,138 @@ class SubscribeAttributeUnitTestingOctetString : public SubscribeAttribute { */ class ReadUnitTestingListInt8u : public ReadAttribute { public: - ReadUnitTestingListInt8u() - : ReadAttribute("list-int8u") - { - } - - ~ReadUnitTestingListInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeListInt8uWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListInt8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListInt8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListInt8u() : ReadAttribute("list-int8u") {} + + ~ReadUnitTestingListInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeListInt8uWithCompletion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.ListInt8u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting ListInt8u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListInt8u : public WriteAttribute { public: - WriteUnitTestingListInt8u() - : WriteAttribute("list-int8u") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-int8u"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeListInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ListInt8u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingListInt8u() + : WriteAttribute("list-int8u"), mComplex(&mValue) { + AddArgument("attr-name", "list-int8u"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + NSNumber *newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster writeAttributeListInt8uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting ListInt8u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + chip::app::DataModel::List mValue; + TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListInt8u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListInt8u() - : SubscribeAttribute("list-int8u") - { - } + SubscribeAttributeUnitTestingListInt8u() : SubscribeAttribute("list-int8u") {} - ~SubscribeAttributeUnitTestingListInt8u() {} + ~SubscribeAttributeUnitTestingListInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListInt8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListInt8u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90724,120 +107012,144 @@ class SubscribeAttributeUnitTestingListInt8u : public SubscribeAttribute { */ class ReadUnitTestingListOctetString : public ReadAttribute { public: - ReadUnitTestingListOctetString() - : ReadAttribute("list-octet-string") - { - } - - ~ReadUnitTestingListOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeListOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListOctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListOctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListOctetString() : ReadAttribute("list-octet-string") {} + + ~ReadUnitTestingListOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeListOctetStringWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListOctetString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting ListOctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListOctetString : public WriteAttribute { public: - WriteUnitTestingListOctetString() - : WriteAttribute("list-octet-string") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-octet-string"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeListOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ListOctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingListOctetString() + : WriteAttribute("list-octet-string"), mComplex(&mValue) { + AddArgument("attr-name", "list-octet-string"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + NSData *newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() + length:entry_0.size()]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeListOctetStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting ListOctetString write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + chip::app::DataModel::List mValue; + TypedComplexArgument> + mComplex; }; class SubscribeAttributeUnitTestingListOctetString : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListOctetString() - : SubscribeAttribute("list-octet-string") - { - } + SubscribeAttributeUnitTestingListOctetString() + : SubscribeAttribute("list-octet-string") {} - ~SubscribeAttributeUnitTestingListOctetString() {} + ~SubscribeAttributeUnitTestingListOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListOctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListOctetString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90845,123 +107157,155 @@ class SubscribeAttributeUnitTestingListOctetString : public SubscribeAttribute { */ class ReadUnitTestingListStructOctetString : public ReadAttribute { public: - ReadUnitTestingListStructOctetString() - : ReadAttribute("list-struct-octet-string") - { - } - - ~ReadUnitTestingListStructOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeListStructOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListStructOctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListStructOctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListStructOctetString() + : ReadAttribute("list-struct-octet-string") {} + + ~ReadUnitTestingListStructOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeListStructOctetStringWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListStructOctetString response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting ListStructOctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListStructOctetString : public WriteAttribute { public: - WriteUnitTestingListStructOctetString() - : WriteAttribute("list-struct-octet-string") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-struct-octet-string"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListStructOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRUnitTestingClusterTestListStructOctet * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; - newElement_0.member1 = [NSNumber numberWithUnsignedLongLong:entry_0.member1]; - newElement_0.member2 = [NSData dataWithBytes:entry_0.member2.data() length:entry_0.member2.size()]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeListStructOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ListStructOctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingListStructOctetString() + : WriteAttribute("list-struct-octet-string"), mComplex(&mValue) { + AddArgument("attr-name", "list-struct-octet-string"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListStructOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRUnitTestingClusterTestListStructOctet *newElement_0; + newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; + newElement_0.member1 = + [NSNumber numberWithUnsignedLongLong:entry_0.member1]; + newElement_0.member2 = [NSData dataWithBytes:entry_0.member2.data() + length:entry_0.member2.size()]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeListStructOctetStringWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "ListStructOctetString" + " write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> - mComplex; + chip::app::DataModel::List + mValue; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex; }; -class SubscribeAttributeUnitTestingListStructOctetString : public SubscribeAttribute { +class SubscribeAttributeUnitTestingListStructOctetString + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListStructOctetString() - : SubscribeAttribute("list-struct-octet-string") - { - } + SubscribeAttributeUnitTestingListStructOctetString() + : SubscribeAttribute("list-struct-octet-string") {} - ~SubscribeAttributeUnitTestingListStructOctetString() {} + ~SubscribeAttributeUnitTestingListStructOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListStructOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListStructOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListStructOctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListStructOctetString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -90969,109 +107313,132 @@ class SubscribeAttributeUnitTestingListStructOctetString : public SubscribeAttri */ class ReadUnitTestingLongOctetString : public ReadAttribute { public: - ReadUnitTestingLongOctetString() - : ReadAttribute("long-octet-string") - { - } - - ~ReadUnitTestingLongOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLongOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.LongOctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting LongOctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingLongOctetString() : ReadAttribute("long-octet-string") {} + + ~ReadUnitTestingLongOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLongOctetStringWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.LongOctetString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting LongOctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingLongOctetString : public WriteAttribute { public: - WriteUnitTestingLongOctetString() - : WriteAttribute("long-octet-string") - { - AddArgument("attr-name", "long-octet-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingLongOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSData * _Nonnull value = [[NSData alloc] initWithBytes:mValue.data() length:mValue.size()]; - - [cluster writeAttributeLongOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting LongOctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingLongOctetString() : WriteAttribute("long-octet-string") { + AddArgument("attr-name", "long-octet-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingLongOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSData *_Nonnull value = [[NSData alloc] initWithBytes:mValue.data() + length:mValue.size()]; + + [cluster + writeAttributeLongOctetStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting LongOctetString write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingLongOctetString : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingLongOctetString() - : SubscribeAttribute("long-octet-string") - { - } + SubscribeAttributeUnitTestingLongOctetString() + : SubscribeAttribute("long-octet-string") {} - ~SubscribeAttributeUnitTestingLongOctetString() {} + ~SubscribeAttributeUnitTestingLongOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLongOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLongOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.LongOctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.LongOctetString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91079,223 +107446,265 @@ class SubscribeAttributeUnitTestingLongOctetString : public SubscribeAttribute { */ class ReadUnitTestingCharString : public ReadAttribute { public: - ReadUnitTestingCharString() - : ReadAttribute("char-string") - { - } - - ~ReadUnitTestingCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.CharString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting CharString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingCharString() : ReadAttribute("char-string") {} + + ~ReadUnitTestingCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeCharStringWithCompletion:^(NSString *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.CharString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting CharString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingCharString : public WriteAttribute { public: - WriteUnitTestingCharString() - : WriteAttribute("char-string") - { - AddArgument("attr-name", "char-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeCharStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting CharString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingCharString() : WriteAttribute("char-string") { + AddArgument("attr-name", "char-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeCharStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting CharString write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingCharString : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingCharString() - : SubscribeAttribute("char-string") - { - } + SubscribeAttributeUnitTestingCharString() + : SubscribeAttribute("char-string") {} - ~SubscribeAttributeUnitTestingCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeCharStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.CharString response %@", [value description]); - SetCommandExitStatus(error); - }]; + ~SubscribeAttributeUnitTestingCharString() {} - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } -}; - -/* - * Attribute LongCharString - */ -class ReadUnitTestingLongCharString : public ReadAttribute { -public: - ReadUnitTestingLongCharString() - : ReadAttribute("long-char-string") - { + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); } - - ~ReadUnitTestingLongCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeLongCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.LongCharString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting LongCharString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeCharStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.CharString response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute LongCharString + */ +class ReadUnitTestingLongCharString : public ReadAttribute { +public: + ReadUnitTestingLongCharString() : ReadAttribute("long-char-string") {} + + ~ReadUnitTestingLongCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000001F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeLongCharStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.LongCharString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting LongCharString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingLongCharString : public WriteAttribute { public: - WriteUnitTestingLongCharString() - : WriteAttribute("long-char-string") - { - AddArgument("attr-name", "long-char-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingLongCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeLongCharStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting LongCharString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingLongCharString() : WriteAttribute("long-char-string") { + AddArgument("attr-name", "long-char-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingLongCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000001F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nonnull value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeLongCharStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting LongCharString " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingLongCharString : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingLongCharString() - : SubscribeAttribute("long-char-string") - { - } + SubscribeAttributeUnitTestingLongCharString() + : SubscribeAttribute("long-char-string") {} - ~SubscribeAttributeUnitTestingLongCharString() {} + ~SubscribeAttributeUnitTestingLongCharString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000001F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeLongCharStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeLongCharStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.LongCharString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.LongCharString response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91303,109 +107712,127 @@ class SubscribeAttributeUnitTestingLongCharString : public SubscribeAttribute { */ class ReadUnitTestingEpochUs : public ReadAttribute { public: - ReadUnitTestingEpochUs() - : ReadAttribute("epoch-us") - { - } - - ~ReadUnitTestingEpochUs() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000020) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEpochUsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EpochUs response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting EpochUs read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingEpochUs() : ReadAttribute("epoch-us") {} + + ~ReadUnitTestingEpochUs() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000020) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEpochUsWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.EpochUs response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting EpochUs read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingEpochUs : public WriteAttribute { public: - WriteUnitTestingEpochUs() - : WriteAttribute("epoch-us") - { - AddArgument("attr-name", "epoch-us"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingEpochUs() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeEpochUsWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting EpochUs write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingEpochUs() : WriteAttribute("epoch-us") { + AddArgument("attr-name", "epoch-us"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingEpochUs() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeEpochUsWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting EpochUs write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingEpochUs : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingEpochUs() - : SubscribeAttribute("epoch-us") - { - } + SubscribeAttributeUnitTestingEpochUs() : SubscribeAttribute("epoch-us") {} - ~SubscribeAttributeUnitTestingEpochUs() {} + ~SubscribeAttributeUnitTestingEpochUs() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000020) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000020) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEpochUsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeEpochUsWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EpochUs response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.EpochUs response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91413,109 +107840,126 @@ class SubscribeAttributeUnitTestingEpochUs : public SubscribeAttribute { */ class ReadUnitTestingEpochS : public ReadAttribute { public: - ReadUnitTestingEpochS() - : ReadAttribute("epoch-s") - { - } - - ~ReadUnitTestingEpochS() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000021) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEpochSWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EpochS response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting EpochS read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingEpochS() : ReadAttribute("epoch-s") {} + + ~ReadUnitTestingEpochS() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000021) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEpochSWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.EpochS response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting EpochS read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingEpochS : public WriteAttribute { public: - WriteUnitTestingEpochS() - : WriteAttribute("epoch-s") - { - AddArgument("attr-name", "epoch-s"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingEpochS() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeEpochSWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting EpochS write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingEpochS() : WriteAttribute("epoch-s") { + AddArgument("attr-name", "epoch-s"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingEpochS() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster writeAttributeEpochSWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting EpochS write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingEpochS : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingEpochS() - : SubscribeAttribute("epoch-s") - { - } + SubscribeAttributeUnitTestingEpochS() : SubscribeAttribute("epoch-s") {} - ~SubscribeAttributeUnitTestingEpochS() {} + ~SubscribeAttributeUnitTestingEpochS() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000021) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000021) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEpochSWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeEpochSWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EpochS response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.EpochS response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91523,109 +107967,127 @@ class SubscribeAttributeUnitTestingEpochS : public SubscribeAttribute { */ class ReadUnitTestingVendorId : public ReadAttribute { public: - ReadUnitTestingVendorId() - : ReadAttribute("vendor-id") - { - } - - ~ReadUnitTestingVendorId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000022) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeVendorIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.VendorId response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting VendorId read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingVendorId() : ReadAttribute("vendor-id") {} + + ~ReadUnitTestingVendorId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000022) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeVendorIdWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.VendorId response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting VendorId read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingVendorId : public WriteAttribute { public: - WriteUnitTestingVendorId() - : WriteAttribute("vendor-id") - { - AddArgument("attr-name", "vendor-id"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingVendorId() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeVendorIdWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting VendorId write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingVendorId() : WriteAttribute("vendor-id") { + AddArgument("attr-name", "vendor-id"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingVendorId() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeVendorIdWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting VendorId write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::VendorId mValue; + chip::VendorId mValue; }; class SubscribeAttributeUnitTestingVendorId : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingVendorId() - : SubscribeAttribute("vendor-id") - { - } + SubscribeAttributeUnitTestingVendorId() : SubscribeAttribute("vendor-id") {} - ~SubscribeAttributeUnitTestingVendorId() {} + ~SubscribeAttributeUnitTestingVendorId() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000022) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000022) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeVendorIdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeVendorIdWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.VendorId response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.VendorId response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91633,276 +108095,360 @@ class SubscribeAttributeUnitTestingVendorId : public SubscribeAttribute { */ class ReadUnitTestingListNullablesAndOptionalsStruct : public ReadAttribute { public: - ReadUnitTestingListNullablesAndOptionalsStruct() - : ReadAttribute("list-nullables-and-optionals-struct") - { - } - - ~ReadUnitTestingListNullablesAndOptionalsStruct() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000023) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster - readAttributeListNullablesAndOptionalsStructWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListNullablesAndOptionalsStruct read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListNullablesAndOptionalsStruct() + : ReadAttribute("list-nullables-and-optionals-struct") {} + + ~ReadUnitTestingListNullablesAndOptionalsStruct() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000023) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeListNullablesAndOptionalsStructWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting ListNullablesAndOptionalsStruct read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListNullablesAndOptionalsStruct : public WriteAttribute { public: - WriteUnitTestingListNullablesAndOptionalsStruct() - : WriteAttribute("list-nullables-and-optionals-struct") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-nullables-and-optionals-struct"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListNullablesAndOptionalsStruct() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; - if (entry_0.nullableInt.IsNull()) { - newElement_0.nullableInt = nil; - } else { - newElement_0.nullableInt = [NSNumber numberWithUnsignedShort:entry_0.nullableInt.Value()]; - } - if (entry_0.optionalInt.HasValue()) { - newElement_0.optionalInt = [NSNumber numberWithUnsignedShort:entry_0.optionalInt.Value()]; - } else { - newElement_0.optionalInt = nil; - } - if (entry_0.nullableOptionalInt.HasValue()) { - if (entry_0.nullableOptionalInt.Value().IsNull()) { - newElement_0.nullableOptionalInt = nil; - } else { - newElement_0.nullableOptionalInt = - [NSNumber numberWithUnsignedShort:entry_0.nullableOptionalInt.Value().Value()]; - } - } else { - newElement_0.nullableOptionalInt = nil; - } - if (entry_0.nullableString.IsNull()) { - newElement_0.nullableString = nil; - } else { - newElement_0.nullableString = [[NSString alloc] initWithBytes:entry_0.nullableString.Value().data() - length:entry_0.nullableString.Value().size() - encoding:NSUTF8StringEncoding]; - } - if (entry_0.optionalString.HasValue()) { - newElement_0.optionalString = [[NSString alloc] initWithBytes:entry_0.optionalString.Value().data() - length:entry_0.optionalString.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.optionalString = nil; - } - if (entry_0.nullableOptionalString.HasValue()) { - if (entry_0.nullableOptionalString.Value().IsNull()) { - newElement_0.nullableOptionalString = nil; - } else { - newElement_0.nullableOptionalString = - [[NSString alloc] initWithBytes:entry_0.nullableOptionalString.Value().Value().data() - length:entry_0.nullableOptionalString.Value().Value().size() - encoding:NSUTF8StringEncoding]; - } - } else { - newElement_0.nullableOptionalString = nil; - } - if (entry_0.nullableStruct.IsNull()) { - newElement_0.nullableStruct = nil; - } else { - newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.nullableStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; - newElement_0.nullableStruct.b = [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; - newElement_0.nullableStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().c)]; - newElement_0.nullableStruct.d = [NSData dataWithBytes:entry_0.nullableStruct.Value().d.data() - length:entry_0.nullableStruct.Value().d.size()]; - newElement_0.nullableStruct.e = [[NSString alloc] initWithBytes:entry_0.nullableStruct.Value().e.data() - length:entry_0.nullableStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; - newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; - newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; - } - if (entry_0.optionalStruct.HasValue()) { - newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.optionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; - newElement_0.optionalStruct.b = [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; - newElement_0.optionalStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().c)]; - newElement_0.optionalStruct.d = [NSData dataWithBytes:entry_0.optionalStruct.Value().d.data() - length:entry_0.optionalStruct.Value().d.size()]; - newElement_0.optionalStruct.e = [[NSString alloc] initWithBytes:entry_0.optionalStruct.Value().e.data() - length:entry_0.optionalStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; - newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; - newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; - } else { - newElement_0.optionalStruct = nil; - } - if (entry_0.nullableOptionalStruct.HasValue()) { - if (entry_0.nullableOptionalStruct.Value().IsNull()) { - newElement_0.nullableOptionalStruct = nil; - } else { - newElement_0.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.nullableOptionalStruct.a = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().a]; - newElement_0.nullableOptionalStruct.b = - [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value().Value().b]; - newElement_0.nullableOptionalStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().c)]; - newElement_0.nullableOptionalStruct.d = - [NSData dataWithBytes:entry_0.nullableOptionalStruct.Value().Value().d.data() - length:entry_0.nullableOptionalStruct.Value().Value().d.size()]; - newElement_0.nullableOptionalStruct.e = - [[NSString alloc] initWithBytes:entry_0.nullableOptionalStruct.Value().Value().e.data() - length:entry_0.nullableOptionalStruct.Value().Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.nullableOptionalStruct.f = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; - newElement_0.nullableOptionalStruct.g = - [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; - newElement_0.nullableOptionalStruct.h = - [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; - } - } else { - newElement_0.nullableOptionalStruct = nil; - } - if (entry_0.nullableList.IsNull()) { - newElement_0.nullableList = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.nullableList.Value()) { - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; - [array_3 addObject:newElement_3]; - } - newElement_0.nullableList = array_3; - } - } - if (entry_0.optionalList.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.optionalList.Value()) { - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; - [array_3 addObject:newElement_3]; - } - newElement_0.optionalList = array_3; - } - } else { - newElement_0.optionalList = nil; - } - if (entry_0.nullableOptionalList.HasValue()) { - if (entry_0.nullableOptionalList.Value().IsNull()) { - newElement_0.nullableOptionalList = nil; - } else { - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - for (auto & entry_4 : entry_0.nullableOptionalList.Value().Value()) { - NSNumber * newElement_4; - newElement_4 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_4)]; - [array_4 addObject:newElement_4]; - } - newElement_0.nullableOptionalList = array_4; - } - } - } else { - newElement_0.nullableOptionalList = nil; - } - [array_0 addObject:newElement_0]; - } - value = array_0; + WriteUnitTestingListNullablesAndOptionalsStruct() + : WriteAttribute("list-nullables-and-optionals-struct"), + mComplex(&mValue) { + AddArgument("attr-name", "list-nullables-and-optionals-struct"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListNullablesAndOptionalsStruct() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRUnitTestingClusterNullablesAndOptionalsStruct *newElement_0; + newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; + if (entry_0.nullableInt.IsNull()) { + newElement_0.nullableInt = nil; + } else { + newElement_0.nullableInt = + [NSNumber numberWithUnsignedShort:entry_0.nullableInt.Value()]; } - - [cluster writeAttributeListNullablesAndOptionalsStructWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "UnitTesting ListNullablesAndOptionalsStruct write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + if (entry_0.optionalInt.HasValue()) { + newElement_0.optionalInt = + [NSNumber numberWithUnsignedShort:entry_0.optionalInt.Value()]; + } else { + newElement_0.optionalInt = nil; + } + if (entry_0.nullableOptionalInt.HasValue()) { + if (entry_0.nullableOptionalInt.Value().IsNull()) { + newElement_0.nullableOptionalInt = nil; + } else { + newElement_0.nullableOptionalInt = [NSNumber + numberWithUnsignedShort:entry_0.nullableOptionalInt.Value() + .Value()]; + } + } else { + newElement_0.nullableOptionalInt = nil; + } + if (entry_0.nullableString.IsNull()) { + newElement_0.nullableString = nil; + } else { + newElement_0.nullableString = [[NSString alloc] + initWithBytes:entry_0.nullableString.Value().data() + length:entry_0.nullableString.Value().size() + encoding:NSUTF8StringEncoding]; + } + if (entry_0.optionalString.HasValue()) { + newElement_0.optionalString = [[NSString alloc] + initWithBytes:entry_0.optionalString.Value().data() + length:entry_0.optionalString.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.optionalString = nil; + } + if (entry_0.nullableOptionalString.HasValue()) { + if (entry_0.nullableOptionalString.Value().IsNull()) { + newElement_0.nullableOptionalString = nil; + } else { + newElement_0.nullableOptionalString = [[NSString alloc] + initWithBytes:entry_0.nullableOptionalString.Value() + .Value() + .data() + length:entry_0.nullableOptionalString.Value() + .Value() + .size() + encoding:NSUTF8StringEncoding]; + } + } else { + newElement_0.nullableOptionalString = nil; + } + if (entry_0.nullableStruct.IsNull()) { + newElement_0.nullableStruct = nil; + } else { + newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableStruct.a = [NSNumber + numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; + newElement_0.nullableStruct.b = + [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; + newElement_0.nullableStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + entry_0.nullableStruct.Value().c)]; + newElement_0.nullableStruct.d = + [NSData dataWithBytes:entry_0.nullableStruct.Value().d.data() + length:entry_0.nullableStruct.Value().d.size()]; + newElement_0.nullableStruct.e = [[NSString alloc] + initWithBytes:entry_0.nullableStruct.Value().e.data() + length:entry_0.nullableStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.nullableStruct.f = [NSNumber + numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; + newElement_0.nullableStruct.g = + [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; + newElement_0.nullableStruct.h = + [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; + } + if (entry_0.optionalStruct.HasValue()) { + newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.optionalStruct.a = [NSNumber + numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; + newElement_0.optionalStruct.b = + [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; + newElement_0.optionalStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + entry_0.optionalStruct.Value().c)]; + newElement_0.optionalStruct.d = + [NSData dataWithBytes:entry_0.optionalStruct.Value().d.data() + length:entry_0.optionalStruct.Value().d.size()]; + newElement_0.optionalStruct.e = [[NSString alloc] + initWithBytes:entry_0.optionalStruct.Value().e.data() + length:entry_0.optionalStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.optionalStruct.f = [NSNumber + numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; + newElement_0.optionalStruct.g = + [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; + newElement_0.optionalStruct.h = + [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; + } else { + newElement_0.optionalStruct = nil; + } + if (entry_0.nullableOptionalStruct.HasValue()) { + if (entry_0.nullableOptionalStruct.Value().IsNull()) { + newElement_0.nullableOptionalStruct = nil; + } else { + newElement_0.nullableOptionalStruct = + [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableOptionalStruct.a = [NSNumber + numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value() + .Value() + .a]; + newElement_0.nullableOptionalStruct.b = + [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value() + .Value() + .b]; + newElement_0.nullableOptionalStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + entry_0.nullableOptionalStruct + .Value() + .Value() + .c)]; + newElement_0.nullableOptionalStruct.d = + [NSData dataWithBytes:entry_0.nullableOptionalStruct.Value() + .Value() + .d.data() + length:entry_0.nullableOptionalStruct.Value() + .Value() + .d.size()]; + newElement_0.nullableOptionalStruct.e = [[NSString alloc] + initWithBytes:entry_0.nullableOptionalStruct.Value() + .Value() + .e.data() + length:entry_0.nullableOptionalStruct.Value() + .Value() + .e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.nullableOptionalStruct.f = [NSNumber + numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value() + .Value() + .f.Raw()]; + newElement_0.nullableOptionalStruct.g = + [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value() + .Value() + .g]; + newElement_0.nullableOptionalStruct.h = [NSNumber + numberWithDouble:entry_0.nullableOptionalStruct.Value() + .Value() + .h]; + } + } else { + newElement_0.nullableOptionalStruct = nil; + } + if (entry_0.nullableList.IsNull()) { + newElement_0.nullableList = nil; + } else { + { // Scope for our temporary variables + auto *array_3 = [NSMutableArray new]; + for (auto &entry_3 : entry_0.nullableList.Value()) { + NSNumber *newElement_3; + newElement_3 = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_3)]; + [array_3 addObject:newElement_3]; + } + newElement_0.nullableList = array_3; + } + } + if (entry_0.optionalList.HasValue()) { + { // Scope for our temporary variables + auto *array_3 = [NSMutableArray new]; + for (auto &entry_3 : entry_0.optionalList.Value()) { + NSNumber *newElement_3; + newElement_3 = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_3)]; + [array_3 addObject:newElement_3]; + } + newElement_0.optionalList = array_3; + } + } else { + newElement_0.optionalList = nil; + } + if (entry_0.nullableOptionalList.HasValue()) { + if (entry_0.nullableOptionalList.Value().IsNull()) { + newElement_0.nullableOptionalList = nil; + } else { + { // Scope for our temporary variables + auto *array_4 = [NSMutableArray new]; + for (auto &entry_4 : + entry_0.nullableOptionalList.Value().Value()) { + NSNumber *newElement_4; + newElement_4 = [NSNumber + numberWithUnsignedChar:chip::to_underlying(entry_4)]; + [array_4 addObject:newElement_4]; + } + newElement_0.nullableOptionalList = array_4; + } + } + } else { + newElement_0.nullableOptionalList = nil; + } + [array_0 addObject:newElement_0]; + } + value = array_0; } + [cluster + writeAttributeListNullablesAndOptionalsStructWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting " + "ListNullablesAndOp" + "tionalsStruct " + "write Error", + error); + } + SetCommandExitStatus( + error); + }]; + return CHIP_NO_ERROR; + } + private: - chip::app::DataModel::List mValue; - TypedComplexArgument< - chip::app::DataModel::List> - mComplex; + chip::app::DataModel::List + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct : public SubscribeAttribute { +class SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() - : SubscribeAttribute("list-nullables-and-optionals-struct") - { - } + SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() + : SubscribeAttribute("list-nullables-and-optionals-struct") {} - ~SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() {} + ~SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000023) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000023) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListNullablesAndOptionalsStructWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListNullablesAndOptionalsStructWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -91910,109 +108456,127 @@ class SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct : public Subs */ class ReadUnitTestingEnumAttr : public ReadAttribute { public: - ReadUnitTestingEnumAttr() - : ReadAttribute("enum-attr") - { - } - - ~ReadUnitTestingEnumAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeEnumAttrWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EnumAttr response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting EnumAttr read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingEnumAttr() : ReadAttribute("enum-attr") {} + + ~ReadUnitTestingEnumAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeEnumAttrWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.EnumAttr response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting EnumAttr read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingEnumAttr : public WriteAttribute { public: - WriteUnitTestingEnumAttr() - : WriteAttribute("enum-attr") - { - AddArgument("attr-name", "enum-attr"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingEnumAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeEnumAttrWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting EnumAttr write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingEnumAttr() : WriteAttribute("enum-attr") { + AddArgument("attr-name", "enum-attr"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingEnumAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeEnumAttrWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting EnumAttr write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingEnumAttr : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingEnumAttr() - : SubscribeAttribute("enum-attr") - { - } + SubscribeAttributeUnitTestingEnumAttr() : SubscribeAttribute("enum-attr") {} - ~SubscribeAttributeUnitTestingEnumAttr() {} + ~SubscribeAttributeUnitTestingEnumAttr() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEnumAttrWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeEnumAttrWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.EnumAttr response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.EnumAttr response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92020,121 +108584,146 @@ class SubscribeAttributeUnitTestingEnumAttr : public SubscribeAttribute { */ class ReadUnitTestingStructAttr : public ReadAttribute { public: - ReadUnitTestingStructAttr() - : ReadAttribute("struct-attr") - { - } - - ~ReadUnitTestingStructAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeStructAttrWithCompletion:^( - MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.StructAttr response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting StructAttr read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingStructAttr() : ReadAttribute("struct-attr") {} + + ~ReadUnitTestingStructAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeStructAttrWithCompletion:^( + MTRUnitTestingClusterSimpleStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.StructAttr response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting StructAttr read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingStructAttr : public WriteAttribute { public: - WriteUnitTestingStructAttr() - : WriteAttribute("struct-attr") - , mComplex(&mValue) - { - AddArgument("attr-name", "struct-attr"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingStructAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - MTRUnitTestingClusterSimpleStruct * _Nonnull value; - value = [MTRUnitTestingClusterSimpleStruct new]; - value.a = [NSNumber numberWithUnsignedChar:mValue.a]; - value.b = [NSNumber numberWithBool:mValue.b]; - value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.c)]; - value.d = [NSData dataWithBytes:mValue.d.data() length:mValue.d.size()]; - value.e = [[NSString alloc] initWithBytes:mValue.e.data() length:mValue.e.size() encoding:NSUTF8StringEncoding]; - value.f = [NSNumber numberWithUnsignedChar:mValue.f.Raw()]; - value.g = [NSNumber numberWithFloat:mValue.g]; - value.h = [NSNumber numberWithDouble:mValue.h]; - - [cluster writeAttributeStructAttrWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting StructAttr write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingStructAttr() + : WriteAttribute("struct-attr"), mComplex(&mValue) { + AddArgument("attr-name", "struct-attr"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingStructAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + MTRUnitTestingClusterSimpleStruct *_Nonnull value; + value = [MTRUnitTestingClusterSimpleStruct new]; + value.a = [NSNumber numberWithUnsignedChar:mValue.a]; + value.b = [NSNumber numberWithBool:mValue.b]; + value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.c)]; + value.d = [NSData dataWithBytes:mValue.d.data() length:mValue.d.size()]; + value.e = [[NSString alloc] initWithBytes:mValue.e.data() + length:mValue.e.size() + encoding:NSUTF8StringEncoding]; + value.f = [NSNumber numberWithUnsignedChar:mValue.f.Raw()]; + value.g = [NSNumber numberWithFloat:mValue.g]; + value.h = [NSNumber numberWithDouble:mValue.h]; + + [cluster + writeAttributeStructAttrWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting StructAttr write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type mValue; - TypedComplexArgument mComplex; + chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type mValue; + TypedComplexArgument< + chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type> + mComplex; }; class SubscribeAttributeUnitTestingStructAttr : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingStructAttr() - : SubscribeAttribute("struct-attr") - { - } + SubscribeAttributeUnitTestingStructAttr() + : SubscribeAttribute("struct-attr") {} - ~SubscribeAttributeUnitTestingStructAttr() {} + ~SubscribeAttributeUnitTestingStructAttr() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStructAttrWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeStructAttrWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.StructAttr response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(MTRUnitTestingClusterSimpleStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.StructAttr response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92142,109 +108731,135 @@ class SubscribeAttributeUnitTestingStructAttr : public SubscribeAttribute { */ class ReadUnitTestingRangeRestrictedInt8u : public ReadAttribute { public: - ReadUnitTestingRangeRestrictedInt8u() - : ReadAttribute("range-restricted-int8u") - { - } - - ~ReadUnitTestingRangeRestrictedInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRangeRestrictedInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingRangeRestrictedInt8u() + : ReadAttribute("range-restricted-int8u") {} + + ~ReadUnitTestingRangeRestrictedInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000026) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRangeRestrictedInt8uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting RangeRestrictedInt8u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingRangeRestrictedInt8u : public WriteAttribute { public: - WriteUnitTestingRangeRestrictedInt8u() - : WriteAttribute("range-restricted-int8u") - { - AddArgument("attr-name", "range-restricted-int8u"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingRangeRestrictedInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeRangeRestrictedInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt8u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingRangeRestrictedInt8u() + : WriteAttribute("range-restricted-int8u") { + AddArgument("attr-name", "range-restricted-int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingRangeRestrictedInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeRangeRestrictedInt8uWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "RangeRestrictedIn" + "t8u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeUnitTestingRangeRestrictedInt8u : public SubscribeAttribute { +class SubscribeAttributeUnitTestingRangeRestrictedInt8u + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingRangeRestrictedInt8u() - : SubscribeAttribute("range-restricted-int8u") - { - } + SubscribeAttributeUnitTestingRangeRestrictedInt8u() + : SubscribeAttribute("range-restricted-int8u") {} - ~SubscribeAttributeUnitTestingRangeRestrictedInt8u() {} + ~SubscribeAttributeUnitTestingRangeRestrictedInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRangeRestrictedInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRangeRestrictedInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92252,109 +108867,135 @@ class SubscribeAttributeUnitTestingRangeRestrictedInt8u : public SubscribeAttrib */ class ReadUnitTestingRangeRestrictedInt8s : public ReadAttribute { public: - ReadUnitTestingRangeRestrictedInt8s() - : ReadAttribute("range-restricted-int8s") - { - } - - ~ReadUnitTestingRangeRestrictedInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000027) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRangeRestrictedInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt8s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingRangeRestrictedInt8s() + : ReadAttribute("range-restricted-int8s") {} + + ~ReadUnitTestingRangeRestrictedInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000027) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRangeRestrictedInt8sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting RangeRestrictedInt8s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingRangeRestrictedInt8s : public WriteAttribute { public: - WriteUnitTestingRangeRestrictedInt8s() - : WriteAttribute("range-restricted-int8s") - { - AddArgument("attr-name", "range-restricted-int8s"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingRangeRestrictedInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; - - [cluster writeAttributeRangeRestrictedInt8sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt8s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingRangeRestrictedInt8s() + : WriteAttribute("range-restricted-int8s") { + AddArgument("attr-name", "range-restricted-int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingRangeRestrictedInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithChar:mValue]; + + [cluster writeAttributeRangeRestrictedInt8sWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "RangeRestrictedIn" + "t8s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int8_t mValue; + int8_t mValue; }; -class SubscribeAttributeUnitTestingRangeRestrictedInt8s : public SubscribeAttribute { +class SubscribeAttributeUnitTestingRangeRestrictedInt8s + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingRangeRestrictedInt8s() - : SubscribeAttribute("range-restricted-int8s") - { - } + SubscribeAttributeUnitTestingRangeRestrictedInt8s() + : SubscribeAttribute("range-restricted-int8s") {} - ~SubscribeAttributeUnitTestingRangeRestrictedInt8s() {} + ~SubscribeAttributeUnitTestingRangeRestrictedInt8s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRangeRestrictedInt8sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRangeRestrictedInt8sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92362,109 +109003,136 @@ class SubscribeAttributeUnitTestingRangeRestrictedInt8s : public SubscribeAttrib */ class ReadUnitTestingRangeRestrictedInt16u : public ReadAttribute { public: - ReadUnitTestingRangeRestrictedInt16u() - : ReadAttribute("range-restricted-int16u") - { - } - - ~ReadUnitTestingRangeRestrictedInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000028) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRangeRestrictedInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt16u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingRangeRestrictedInt16u() + : ReadAttribute("range-restricted-int16u") {} + + ~ReadUnitTestingRangeRestrictedInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000028) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRangeRestrictedInt16uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting RangeRestrictedInt16u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingRangeRestrictedInt16u : public WriteAttribute { public: - WriteUnitTestingRangeRestrictedInt16u() - : WriteAttribute("range-restricted-int16u") - { - AddArgument("attr-name", "range-restricted-int16u"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingRangeRestrictedInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeRangeRestrictedInt16uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt16u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingRangeRestrictedInt16u() + : WriteAttribute("range-restricted-int16u") { + AddArgument("attr-name", "range-restricted-int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingRangeRestrictedInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeRangeRestrictedInt16uWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "RangeRestrictedInt16u" + " write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeUnitTestingRangeRestrictedInt16u : public SubscribeAttribute { +class SubscribeAttributeUnitTestingRangeRestrictedInt16u + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingRangeRestrictedInt16u() - : SubscribeAttribute("range-restricted-int16u") - { - } + SubscribeAttributeUnitTestingRangeRestrictedInt16u() + : SubscribeAttribute("range-restricted-int16u") {} - ~SubscribeAttributeUnitTestingRangeRestrictedInt16u() {} + ~SubscribeAttributeUnitTestingRangeRestrictedInt16u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRangeRestrictedInt16uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRangeRestrictedInt16uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92472,109 +109140,136 @@ class SubscribeAttributeUnitTestingRangeRestrictedInt16u : public SubscribeAttri */ class ReadUnitTestingRangeRestrictedInt16s : public ReadAttribute { public: - ReadUnitTestingRangeRestrictedInt16s() - : ReadAttribute("range-restricted-int16s") - { - } - - ~ReadUnitTestingRangeRestrictedInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000029) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeRangeRestrictedInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt16s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingRangeRestrictedInt16s() + : ReadAttribute("range-restricted-int16s") {} + + ~ReadUnitTestingRangeRestrictedInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeRangeRestrictedInt16sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting RangeRestrictedInt16s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingRangeRestrictedInt16s : public WriteAttribute { public: - WriteUnitTestingRangeRestrictedInt16s() - : WriteAttribute("range-restricted-int16s") - { - AddArgument("attr-name", "range-restricted-int16s"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingRangeRestrictedInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeRangeRestrictedInt16sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting RangeRestrictedInt16s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingRangeRestrictedInt16s() + : WriteAttribute("range-restricted-int16s") { + AddArgument("attr-name", "range-restricted-int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingRangeRestrictedInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeRangeRestrictedInt16sWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "RangeRestrictedInt16s" + " write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int16_t mValue; + int16_t mValue; }; -class SubscribeAttributeUnitTestingRangeRestrictedInt16s : public SubscribeAttribute { +class SubscribeAttributeUnitTestingRangeRestrictedInt16s + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingRangeRestrictedInt16s() - : SubscribeAttribute("range-restricted-int16s") - { - } + SubscribeAttributeUnitTestingRangeRestrictedInt16s() + : SubscribeAttribute("range-restricted-int16s") {} - ~SubscribeAttributeUnitTestingRangeRestrictedInt16s() {} + ~SubscribeAttributeUnitTestingRangeRestrictedInt16s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRangeRestrictedInt16sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeRangeRestrictedInt16sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92582,120 +109277,147 @@ class SubscribeAttributeUnitTestingRangeRestrictedInt16s : public SubscribeAttri */ class ReadUnitTestingListLongOctetString : public ReadAttribute { public: - ReadUnitTestingListLongOctetString() - : ReadAttribute("list-long-octet-string") - { - } - - ~ReadUnitTestingListLongOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000002A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeListLongOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListLongOctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListLongOctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListLongOctetString() + : ReadAttribute("list-long-octet-string") {} + + ~ReadUnitTestingListLongOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeListLongOctetStringWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListLongOctetString response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting ListLongOctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListLongOctetString : public WriteAttribute { public: - WriteUnitTestingListLongOctetString() - : WriteAttribute("list-long-octet-string") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-long-octet-string"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListLongOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; - [array_0 addObject:newElement_0]; - } - value = array_0; - } - - [cluster writeAttributeListLongOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ListLongOctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingListLongOctetString() + : WriteAttribute("list-long-octet-string"), mComplex(&mValue) { + AddArgument("attr-name", "list-long-octet-string"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListLongOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + NSData *newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() + length:entry_0.size()]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeListLongOctetStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "ListLongOctetString " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + chip::app::DataModel::List mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeUnitTestingListLongOctetString : public SubscribeAttribute { +class SubscribeAttributeUnitTestingListLongOctetString + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListLongOctetString() - : SubscribeAttribute("list-long-octet-string") - { - } + SubscribeAttributeUnitTestingListLongOctetString() + : SubscribeAttribute("list-long-octet-string") {} - ~SubscribeAttributeUnitTestingListLongOctetString() {} + ~SubscribeAttributeUnitTestingListLongOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000002A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000002A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListLongOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListLongOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListLongOctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListLongOctetString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92703,175 +109425,224 @@ class SubscribeAttributeUnitTestingListLongOctetString : public SubscribeAttribu */ class ReadUnitTestingListFabricScoped : public ReadAttribute { public: - ReadUnitTestingListFabricScoped() - : ReadAttribute("list-fabric-scoped") - { - } - - ~ReadUnitTestingListFabricScoped() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000002B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRReadParams alloc] init]; - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - [cluster readAttributeListFabricScopedWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListFabricScoped response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ListFabricScoped read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingListFabricScoped() : ReadAttribute("list-fabric-scoped") {} + + ~ReadUnitTestingListFabricScoped() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster + readAttributeListFabricScopedWithParams:params + completion:^(NSArray *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.ListFabricScoped " + @"response %@", + [value description]); + if (error != nil) { + LogNSError( + "UnitTesting ListFabricScoped " + "read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingListFabricScoped : public WriteAttribute { public: - WriteUnitTestingListFabricScoped() - : WriteAttribute("list-fabric-scoped") - , mComplex(&mValue) - { - AddArgument("attr-name", "list-fabric-scoped"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingListFabricScoped() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000002B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mValue) { - MTRUnitTestingClusterTestFabricScoped * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; - newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; - if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { - newElement_0.optionalFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u.Value()]; - } else { - newElement_0.optionalFabricSensitiveInt8u = nil; - } - if (entry_0.nullableFabricSensitiveInt8u.IsNull()) { - newElement_0.nullableFabricSensitiveInt8u = nil; - } else { - newElement_0.nullableFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.nullableFabricSensitiveInt8u.Value()]; - } - if (entry_0.nullableOptionalFabricSensitiveInt8u.HasValue()) { - if (entry_0.nullableOptionalFabricSensitiveInt8u.Value().IsNull()) { - newElement_0.nullableOptionalFabricSensitiveInt8u = nil; - } else { - newElement_0.nullableOptionalFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalFabricSensitiveInt8u.Value().Value()]; - } - } else { - newElement_0.nullableOptionalFabricSensitiveInt8u = nil; - } - newElement_0.fabricSensitiveCharString = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveCharString.data() - length:entry_0.fabricSensitiveCharString.size() - encoding:NSUTF8StringEncoding]; - newElement_0.fabricSensitiveStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.fabricSensitiveStruct.a = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; - newElement_0.fabricSensitiveStruct.b = [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; - newElement_0.fabricSensitiveStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.c)]; - newElement_0.fabricSensitiveStruct.d = [NSData dataWithBytes:entry_0.fabricSensitiveStruct.d.data() - length:entry_0.fabricSensitiveStruct.d.size()]; - newElement_0.fabricSensitiveStruct.e = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveStruct.e.data() - length:entry_0.fabricSensitiveStruct.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; - newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; - newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - for (auto & entry_2 : entry_0.fabricSensitiveInt8uList) { - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; - [array_2 addObject:newElement_2]; - } - newElement_0.fabricSensitiveInt8uList = array_2; - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - value = array_0; + WriteUnitTestingListFabricScoped() + : WriteAttribute("list-fabric-scoped"), mComplex(&mValue) { + AddArgument("attr-name", "list-fabric-scoped"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingListFabricScoped() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSArray *_Nonnull value; + { // Scope for our temporary variables + auto *array_0 = [NSMutableArray new]; + for (auto &entry_0 : mValue) { + MTRUnitTestingClusterTestFabricScoped *newElement_0; + newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; + newElement_0.fabricSensitiveInt8u = + [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; + if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { + newElement_0.optionalFabricSensitiveInt8u = [NSNumber + numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u + .Value()]; + } else { + newElement_0.optionalFabricSensitiveInt8u = nil; } - - [cluster writeAttributeListFabricScopedWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ListFabricScoped write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + if (entry_0.nullableFabricSensitiveInt8u.IsNull()) { + newElement_0.nullableFabricSensitiveInt8u = nil; + } else { + newElement_0.nullableFabricSensitiveInt8u = [NSNumber + numberWithUnsignedChar:entry_0.nullableFabricSensitiveInt8u + .Value()]; + } + if (entry_0.nullableOptionalFabricSensitiveInt8u.HasValue()) { + if (entry_0.nullableOptionalFabricSensitiveInt8u.Value().IsNull()) { + newElement_0.nullableOptionalFabricSensitiveInt8u = nil; + } else { + newElement_0.nullableOptionalFabricSensitiveInt8u = [NSNumber + numberWithUnsignedChar:entry_0 + .nullableOptionalFabricSensitiveInt8u + .Value() + .Value()]; + } + } else { + newElement_0.nullableOptionalFabricSensitiveInt8u = nil; + } + newElement_0.fabricSensitiveCharString = [[NSString alloc] + initWithBytes:entry_0.fabricSensitiveCharString.data() + length:entry_0.fabricSensitiveCharString.size() + encoding:NSUTF8StringEncoding]; + newElement_0.fabricSensitiveStruct = + [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.fabricSensitiveStruct.a = + [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; + newElement_0.fabricSensitiveStruct.b = + [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; + newElement_0.fabricSensitiveStruct.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying( + entry_0.fabricSensitiveStruct.c)]; + newElement_0.fabricSensitiveStruct.d = + [NSData dataWithBytes:entry_0.fabricSensitiveStruct.d.data() + length:entry_0.fabricSensitiveStruct.d.size()]; + newElement_0.fabricSensitiveStruct.e = [[NSString alloc] + initWithBytes:entry_0.fabricSensitiveStruct.e.data() + length:entry_0.fabricSensitiveStruct.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.fabricSensitiveStruct.f = [NSNumber + numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; + newElement_0.fabricSensitiveStruct.g = + [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; + newElement_0.fabricSensitiveStruct.h = + [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; + { // Scope for our temporary variables + auto *array_2 = [NSMutableArray new]; + for (auto &entry_2 : entry_0.fabricSensitiveInt8uList) { + NSNumber *newElement_2; + newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; + [array_2 addObject:newElement_2]; + } + newElement_0.fabricSensitiveInt8uList = array_2; + } + newElement_0.fabricIndex = + [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + value = array_0; + } + + [cluster + writeAttributeListFabricScopedWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting ListFabricScoped " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> - mComplex; + chip::app::DataModel::List< + const chip::app::Clusters::UnitTesting::Structs::TestFabricScoped::Type> + mValue; + TypedComplexArgument> + mComplex; }; -class SubscribeAttributeUnitTestingListFabricScoped : public SubscribeAttribute { +class SubscribeAttributeUnitTestingListFabricScoped + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingListFabricScoped() - : SubscribeAttribute("list-fabric-scoped") - { - } + SubscribeAttributeUnitTestingListFabricScoped() + : SubscribeAttribute("list-fabric-scoped") {} - ~SubscribeAttributeUnitTestingListFabricScoped() {} + ~SubscribeAttributeUnitTestingListFabricScoped() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000002B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000002B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeListFabricScopedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeListFabricScopedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ListFabricScoped response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ListFabricScoped response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92879,109 +109650,132 @@ class SubscribeAttributeUnitTestingListFabricScoped : public SubscribeAttribute */ class ReadUnitTestingTimedWriteBoolean : public ReadAttribute { public: - ReadUnitTestingTimedWriteBoolean() - : ReadAttribute("timed-write-boolean") - { - } - - ~ReadUnitTestingTimedWriteBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000030) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeTimedWriteBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.TimedWriteBoolean response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting TimedWriteBoolean read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingTimedWriteBoolean() : ReadAttribute("timed-write-boolean") {} + + ~ReadUnitTestingTimedWriteBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000030) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeTimedWriteBooleanWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.TimedWriteBoolean response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting TimedWriteBoolean read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingTimedWriteBoolean : public WriteAttribute { public: - WriteUnitTestingTimedWriteBoolean() - : WriteAttribute("timed-write-boolean") - { - AddArgument("attr-name", "timed-write-boolean"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingTimedWriteBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeTimedWriteBooleanWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting TimedWriteBoolean write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingTimedWriteBoolean() : WriteAttribute("timed-write-boolean") { + AddArgument("attr-name", "timed-write-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingTimedWriteBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeTimedWriteBooleanWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting TimedWriteBoolean " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; -class SubscribeAttributeUnitTestingTimedWriteBoolean : public SubscribeAttribute { +class SubscribeAttributeUnitTestingTimedWriteBoolean + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingTimedWriteBoolean() - : SubscribeAttribute("timed-write-boolean") - { - } + SubscribeAttributeUnitTestingTimedWriteBoolean() + : SubscribeAttribute("timed-write-boolean") {} - ~SubscribeAttributeUnitTestingTimedWriteBoolean() {} + ~SubscribeAttributeUnitTestingTimedWriteBoolean() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000030) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000030) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeTimedWriteBooleanWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeTimedWriteBooleanWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.TimedWriteBoolean response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.TimedWriteBoolean response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -92989,109 +109783,135 @@ class SubscribeAttributeUnitTestingTimedWriteBoolean : public SubscribeAttribute */ class ReadUnitTestingGeneralErrorBoolean : public ReadAttribute { public: - ReadUnitTestingGeneralErrorBoolean() - : ReadAttribute("general-error-boolean") - { - } - - ~ReadUnitTestingGeneralErrorBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000031) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneralErrorBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.GeneralErrorBoolean response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting GeneralErrorBoolean read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingGeneralErrorBoolean() + : ReadAttribute("general-error-boolean") {} + + ~ReadUnitTestingGeneralErrorBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000031) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneralErrorBooleanWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.GeneralErrorBoolean response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting GeneralErrorBoolean read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingGeneralErrorBoolean : public WriteAttribute { public: - WriteUnitTestingGeneralErrorBoolean() - : WriteAttribute("general-error-boolean") - { - AddArgument("attr-name", "general-error-boolean"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingGeneralErrorBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeGeneralErrorBooleanWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting GeneralErrorBoolean write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingGeneralErrorBoolean() + : WriteAttribute("general-error-boolean") { + AddArgument("attr-name", "general-error-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingGeneralErrorBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeGeneralErrorBooleanWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "GeneralErrorBoolean " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; -class SubscribeAttributeUnitTestingGeneralErrorBoolean : public SubscribeAttribute { +class SubscribeAttributeUnitTestingGeneralErrorBoolean + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingGeneralErrorBoolean() - : SubscribeAttribute("general-error-boolean") - { - } + SubscribeAttributeUnitTestingGeneralErrorBoolean() + : SubscribeAttribute("general-error-boolean") {} - ~SubscribeAttributeUnitTestingGeneralErrorBoolean() {} + ~SubscribeAttributeUnitTestingGeneralErrorBoolean() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000031) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000031) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneralErrorBooleanWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeGeneralErrorBooleanWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.GeneralErrorBoolean response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.GeneralErrorBoolean response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93099,109 +109919,135 @@ class SubscribeAttributeUnitTestingGeneralErrorBoolean : public SubscribeAttribu */ class ReadUnitTestingClusterErrorBoolean : public ReadAttribute { public: - ReadUnitTestingClusterErrorBoolean() - : ReadAttribute("cluster-error-boolean") - { - } - - ~ReadUnitTestingClusterErrorBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000032) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterErrorBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ClusterErrorBoolean response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ClusterErrorBoolean read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingClusterErrorBoolean() + : ReadAttribute("cluster-error-boolean") {} + + ~ReadUnitTestingClusterErrorBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00000032) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterErrorBooleanWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ClusterErrorBoolean response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting ClusterErrorBoolean read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingClusterErrorBoolean : public WriteAttribute { public: - WriteUnitTestingClusterErrorBoolean() - : WriteAttribute("cluster-error-boolean") - { - AddArgument("attr-name", "cluster-error-boolean"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingClusterErrorBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeClusterErrorBooleanWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting ClusterErrorBoolean write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingClusterErrorBoolean() + : WriteAttribute("cluster-error-boolean") { + AddArgument("attr-name", "cluster-error-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingClusterErrorBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeClusterErrorBooleanWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "ClusterErrorBoolean " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; -class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribute { +class SubscribeAttributeUnitTestingClusterErrorBoolean + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingClusterErrorBoolean() - : SubscribeAttribute("cluster-error-boolean") - { - } + SubscribeAttributeUnitTestingClusterErrorBoolean() + : SubscribeAttribute("cluster-error-boolean") {} - ~SubscribeAttributeUnitTestingClusterErrorBoolean() {} + ~SubscribeAttributeUnitTestingClusterErrorBoolean() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000032) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00000032) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterErrorBooleanWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterErrorBooleanWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ClusterErrorBoolean response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ClusterErrorBoolean response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93209,109 +110055,129 @@ class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribu */ class ReadUnitTestingUnsupported : public ReadAttribute { public: - ReadUnitTestingUnsupported() - : ReadAttribute("unsupported") - { - } - - ~ReadUnitTestingUnsupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x000000FF) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeUnsupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Unsupported response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting Unsupported read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingUnsupported() : ReadAttribute("unsupported") {} + + ~ReadUnitTestingUnsupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x000000FF) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeUnsupportedWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Unsupported response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting Unsupported read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingUnsupported : public WriteAttribute { public: - WriteUnitTestingUnsupported() - : WriteAttribute("unsupported") - { - AddArgument("attr-name", "unsupported"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingUnsupported() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x000000FF) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeUnsupportedWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting Unsupported write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingUnsupported() : WriteAttribute("unsupported") { + AddArgument("attr-name", "unsupported"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingUnsupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x000000FF) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeUnsupportedWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting Unsupported write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; class SubscribeAttributeUnitTestingUnsupported : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingUnsupported() - : SubscribeAttribute("unsupported") - { - } + SubscribeAttributeUnitTestingUnsupported() + : SubscribeAttribute("unsupported") {} - ~SubscribeAttributeUnitTestingUnsupported() {} + ~SubscribeAttributeUnitTestingUnsupported() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x000000FF) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x000000FF) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeUnsupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeUnsupportedWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.Unsupported response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.Unsupported response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93319,109 +110185,131 @@ class SubscribeAttributeUnitTestingUnsupported : public SubscribeAttribute { */ class ReadUnitTestingNullableBoolean : public ReadAttribute { public: - ReadUnitTestingNullableBoolean() - : ReadAttribute("nullable-boolean") - { - } - - ~ReadUnitTestingNullableBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004000) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBoolean response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableBoolean read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableBoolean() : ReadAttribute("nullable-boolean") {} + + ~ReadUnitTestingNullableBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004000) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableBooleanWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBoolean response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableBoolean read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableBoolean : public WriteAttribute { public: - WriteUnitTestingNullableBoolean() - : WriteAttribute("nullable-boolean") - { - AddArgument("attr-name", "nullable-boolean"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableBoolean() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeNullableBooleanWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableBoolean write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableBoolean() : WriteAttribute("nullable-boolean") { + AddArgument("attr-name", "nullable-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableBoolean() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithBool:mValue]; + + [cluster + writeAttributeNullableBooleanWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableBoolean write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - bool mValue; + bool mValue; }; class SubscribeAttributeUnitTestingNullableBoolean : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableBoolean() - : SubscribeAttribute("nullable-boolean") - { - } + SubscribeAttributeUnitTestingNullableBoolean() + : SubscribeAttribute("nullable-boolean") {} - ~SubscribeAttributeUnitTestingNullableBoolean() {} + ~SubscribeAttributeUnitTestingNullableBoolean() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004000) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004000) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableBooleanWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableBooleanWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBoolean response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBoolean response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93429,109 +110317,131 @@ class SubscribeAttributeUnitTestingNullableBoolean : public SubscribeAttribute { */ class ReadUnitTestingNullableBitmap8 : public ReadAttribute { public: - ReadUnitTestingNullableBitmap8() - : ReadAttribute("nullable-bitmap8") - { - } - - ~ReadUnitTestingNullableBitmap8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004001) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableBitmap8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap8 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableBitmap8 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableBitmap8() : ReadAttribute("nullable-bitmap8") {} + + ~ReadUnitTestingNullableBitmap8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004001) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableBitmap8WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap8 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableBitmap8 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableBitmap8 : public WriteAttribute { public: - WriteUnitTestingNullableBitmap8() - : WriteAttribute("nullable-bitmap8") - { - AddArgument("attr-name", "nullable-bitmap8"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableBitmap8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeNullableBitmap8WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableBitmap8 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableBitmap8() : WriteAttribute("nullable-bitmap8") { + AddArgument("attr-name", "nullable-bitmap8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableBitmap8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeNullableBitmap8WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableBitmap8 write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingNullableBitmap8 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableBitmap8() - : SubscribeAttribute("nullable-bitmap8") - { - } + SubscribeAttributeUnitTestingNullableBitmap8() + : SubscribeAttribute("nullable-bitmap8") {} - ~SubscribeAttributeUnitTestingNullableBitmap8() {} + ~SubscribeAttributeUnitTestingNullableBitmap8() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004001) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004001) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableBitmap8WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableBitmap8WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap8 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap8 response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93539,109 +110449,132 @@ class SubscribeAttributeUnitTestingNullableBitmap8 : public SubscribeAttribute { */ class ReadUnitTestingNullableBitmap16 : public ReadAttribute { public: - ReadUnitTestingNullableBitmap16() - : ReadAttribute("nullable-bitmap16") - { - } - - ~ReadUnitTestingNullableBitmap16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004002) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableBitmap16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap16 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableBitmap16 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableBitmap16() : ReadAttribute("nullable-bitmap16") {} + + ~ReadUnitTestingNullableBitmap16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004002) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableBitmap16WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap16 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableBitmap16 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableBitmap16 : public WriteAttribute { public: - WriteUnitTestingNullableBitmap16() - : WriteAttribute("nullable-bitmap16") - { - AddArgument("attr-name", "nullable-bitmap16"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableBitmap16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeNullableBitmap16WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableBitmap16 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableBitmap16() : WriteAttribute("nullable-bitmap16") { + AddArgument("attr-name", "nullable-bitmap16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableBitmap16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeNullableBitmap16WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableBitmap16 " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeUnitTestingNullableBitmap16 : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableBitmap16 + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableBitmap16() - : SubscribeAttribute("nullable-bitmap16") - { - } + SubscribeAttributeUnitTestingNullableBitmap16() + : SubscribeAttribute("nullable-bitmap16") {} - ~SubscribeAttributeUnitTestingNullableBitmap16() {} + ~SubscribeAttributeUnitTestingNullableBitmap16() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004002) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004002) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableBitmap16WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableBitmap16WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap16 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap16 response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93649,109 +110582,132 @@ class SubscribeAttributeUnitTestingNullableBitmap16 : public SubscribeAttribute */ class ReadUnitTestingNullableBitmap32 : public ReadAttribute { public: - ReadUnitTestingNullableBitmap32() - : ReadAttribute("nullable-bitmap32") - { - } - - ~ReadUnitTestingNullableBitmap32() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004003) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableBitmap32WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap32 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableBitmap32 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableBitmap32() : ReadAttribute("nullable-bitmap32") {} + + ~ReadUnitTestingNullableBitmap32() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004003) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableBitmap32WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap32 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableBitmap32 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableBitmap32 : public WriteAttribute { public: - WriteUnitTestingNullableBitmap32() - : WriteAttribute("nullable-bitmap32") - { - AddArgument("attr-name", "nullable-bitmap32"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableBitmap32() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeNullableBitmap32WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableBitmap32 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableBitmap32() : WriteAttribute("nullable-bitmap32") { + AddArgument("attr-name", "nullable-bitmap32"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableBitmap32() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeNullableBitmap32WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableBitmap32 " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; -class SubscribeAttributeUnitTestingNullableBitmap32 : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableBitmap32 + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableBitmap32() - : SubscribeAttribute("nullable-bitmap32") - { - } + SubscribeAttributeUnitTestingNullableBitmap32() + : SubscribeAttribute("nullable-bitmap32") {} - ~SubscribeAttributeUnitTestingNullableBitmap32() {} + ~SubscribeAttributeUnitTestingNullableBitmap32() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004003) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004003) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableBitmap32WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableBitmap32WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap32 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap32 response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93759,109 +110715,132 @@ class SubscribeAttributeUnitTestingNullableBitmap32 : public SubscribeAttribute */ class ReadUnitTestingNullableBitmap64 : public ReadAttribute { public: - ReadUnitTestingNullableBitmap64() - : ReadAttribute("nullable-bitmap64") - { - } - - ~ReadUnitTestingNullableBitmap64() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004004) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableBitmap64WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap64 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableBitmap64 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableBitmap64() : ReadAttribute("nullable-bitmap64") {} + + ~ReadUnitTestingNullableBitmap64() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004004) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableBitmap64WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap64 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableBitmap64 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableBitmap64 : public WriteAttribute { public: - WriteUnitTestingNullableBitmap64() - : WriteAttribute("nullable-bitmap64") - { - AddArgument("attr-name", "nullable-bitmap64"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableBitmap64() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeNullableBitmap64WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableBitmap64 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableBitmap64() : WriteAttribute("nullable-bitmap64") { + AddArgument("attr-name", "nullable-bitmap64"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableBitmap64() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeNullableBitmap64WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableBitmap64 " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; -class SubscribeAttributeUnitTestingNullableBitmap64 : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableBitmap64 + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableBitmap64() - : SubscribeAttribute("nullable-bitmap64") - { - } + SubscribeAttributeUnitTestingNullableBitmap64() + : SubscribeAttribute("nullable-bitmap64") {} - ~SubscribeAttributeUnitTestingNullableBitmap64() {} + ~SubscribeAttributeUnitTestingNullableBitmap64() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004004) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004004) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableBitmap64WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableBitmap64WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableBitmap64 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableBitmap64 response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93869,109 +110848,129 @@ class SubscribeAttributeUnitTestingNullableBitmap64 : public SubscribeAttribute */ class ReadUnitTestingNullableInt8u : public ReadAttribute { public: - ReadUnitTestingNullableInt8u() - : ReadAttribute("nullable-int8u") - { - } - - ~ReadUnitTestingNullableInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004005) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt8u() : ReadAttribute("nullable-int8u") {} + + ~ReadUnitTestingNullableInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004005) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt8uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt8u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt8u : public WriteAttribute { public: - WriteUnitTestingNullableInt8u() - : WriteAttribute("nullable-int8u") - { - AddArgument("attr-name", "nullable-int8u"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeNullableInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt8u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt8u() : WriteAttribute("nullable-int8u") { + AddArgument("attr-name", "nullable-int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeNullableInt8uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt8u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingNullableInt8u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt8u() - : SubscribeAttribute("nullable-int8u") - { - } + SubscribeAttributeUnitTestingNullableInt8u() + : SubscribeAttribute("nullable-int8u") {} - ~SubscribeAttributeUnitTestingNullableInt8u() {} + ~SubscribeAttributeUnitTestingNullableInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004005) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004005) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -93979,109 +110978,129 @@ class SubscribeAttributeUnitTestingNullableInt8u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt16u : public ReadAttribute { public: - ReadUnitTestingNullableInt16u() - : ReadAttribute("nullable-int16u") - { - } - - ~ReadUnitTestingNullableInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004006) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt16u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt16u() : ReadAttribute("nullable-int16u") {} + + ~ReadUnitTestingNullableInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004006) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt16uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt16u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt16u : public WriteAttribute { public: - WriteUnitTestingNullableInt16u() - : WriteAttribute("nullable-int16u") - { - AddArgument("attr-name", "nullable-int16u"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeNullableInt16uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt16u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt16u() : WriteAttribute("nullable-int16u") { + AddArgument("attr-name", "nullable-int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeNullableInt16uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt16u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeUnitTestingNullableInt16u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt16u() - : SubscribeAttribute("nullable-int16u") - { - } + SubscribeAttributeUnitTestingNullableInt16u() + : SubscribeAttribute("nullable-int16u") {} - ~SubscribeAttributeUnitTestingNullableInt16u() {} + ~SubscribeAttributeUnitTestingNullableInt16u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004006) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004006) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt16uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt16uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94089,109 +111108,129 @@ class SubscribeAttributeUnitTestingNullableInt16u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt24u : public ReadAttribute { public: - ReadUnitTestingNullableInt24u() - : ReadAttribute("nullable-int24u") - { - } - - ~ReadUnitTestingNullableInt24u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004007) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt24uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt24u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt24u() : ReadAttribute("nullable-int24u") {} + + ~ReadUnitTestingNullableInt24u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004007) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt24uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt24u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt24u : public WriteAttribute { public: - WriteUnitTestingNullableInt24u() - : WriteAttribute("nullable-int24u") - { - AddArgument("attr-name", "nullable-int24u"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt24u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeNullableInt24uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt24u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt24u() : WriteAttribute("nullable-int24u") { + AddArgument("attr-name", "nullable-int24u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt24u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeNullableInt24uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt24u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingNullableInt24u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt24u() - : SubscribeAttribute("nullable-int24u") - { - } + SubscribeAttributeUnitTestingNullableInt24u() + : SubscribeAttribute("nullable-int24u") {} - ~SubscribeAttributeUnitTestingNullableInt24u() {} + ~SubscribeAttributeUnitTestingNullableInt24u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004007) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004007) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt24uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt24uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94199,219 +111238,259 @@ class SubscribeAttributeUnitTestingNullableInt24u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt32u : public ReadAttribute { public: - ReadUnitTestingNullableInt32u() - : ReadAttribute("nullable-int32u") - { - } - - ~ReadUnitTestingNullableInt32u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004008) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt32uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt32u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt32u() : ReadAttribute("nullable-int32u") {} + + ~ReadUnitTestingNullableInt32u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004008) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt32uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt32u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt32u : public WriteAttribute { public: - WriteUnitTestingNullableInt32u() - : WriteAttribute("nullable-int32u") - { - AddArgument("attr-name", "nullable-int32u"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt32u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedInt:mValue]; - - [cluster writeAttributeNullableInt32uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt32u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt32u() : WriteAttribute("nullable-int32u") { + AddArgument("attr-name", "nullable-int32u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt32u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedInt:mValue]; + + [cluster + writeAttributeNullableInt32uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt32u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint32_t mValue; + uint32_t mValue; }; class SubscribeAttributeUnitTestingNullableInt32u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt32u() - : SubscribeAttribute("nullable-int32u") - { - } + SubscribeAttributeUnitTestingNullableInt32u() + : SubscribeAttribute("nullable-int32u") {} - ~SubscribeAttributeUnitTestingNullableInt32u() {} + ~SubscribeAttributeUnitTestingNullableInt32u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004008) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004008) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt32uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt32uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* * Attribute NullableInt40u */ class ReadUnitTestingNullableInt40u : public ReadAttribute { -public: - ReadUnitTestingNullableInt40u() - : ReadAttribute("nullable-int40u") - { - } - - ~ReadUnitTestingNullableInt40u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004009) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt40uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt40u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteUnitTestingNullableInt40u : public WriteAttribute { -public: - WriteUnitTestingNullableInt40u() - : WriteAttribute("nullable-int40u") - { - AddArgument("attr-name", "nullable-int40u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt40u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeNullableInt40uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt40u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } +public: + ReadUnitTestingNullableInt40u() : ReadAttribute("nullable-int40u") {} + + ~ReadUnitTestingNullableInt40u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004009) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt40uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt40u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingNullableInt40u : public WriteAttribute { +public: + WriteUnitTestingNullableInt40u() : WriteAttribute("nullable-int40u") { + AddArgument("attr-name", "nullable-int40u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt40u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeNullableInt40uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt40u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt40u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt40u() - : SubscribeAttribute("nullable-int40u") - { - } + SubscribeAttributeUnitTestingNullableInt40u() + : SubscribeAttribute("nullable-int40u") {} - ~SubscribeAttributeUnitTestingNullableInt40u() {} + ~SubscribeAttributeUnitTestingNullableInt40u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004009) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004009) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt40uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt40uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94419,109 +111498,129 @@ class SubscribeAttributeUnitTestingNullableInt40u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt48u : public ReadAttribute { public: - ReadUnitTestingNullableInt48u() - : ReadAttribute("nullable-int48u") - { - } - - ~ReadUnitTestingNullableInt48u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt48uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt48u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt48u() : ReadAttribute("nullable-int48u") {} + + ~ReadUnitTestingNullableInt48u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt48uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt48u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt48u : public WriteAttribute { public: - WriteUnitTestingNullableInt48u() - : WriteAttribute("nullable-int48u") - { - AddArgument("attr-name", "nullable-int48u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt48u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeNullableInt48uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt48u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt48u() : WriteAttribute("nullable-int48u") { + AddArgument("attr-name", "nullable-int48u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt48u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeNullableInt48uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt48u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt48u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt48u() - : SubscribeAttribute("nullable-int48u") - { - } + SubscribeAttributeUnitTestingNullableInt48u() + : SubscribeAttribute("nullable-int48u") {} - ~SubscribeAttributeUnitTestingNullableInt48u() {} + ~SubscribeAttributeUnitTestingNullableInt48u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt48uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt48uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94529,109 +111628,129 @@ class SubscribeAttributeUnitTestingNullableInt48u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt56u : public ReadAttribute { public: - ReadUnitTestingNullableInt56u() - : ReadAttribute("nullable-int56u") - { - } - - ~ReadUnitTestingNullableInt56u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400B) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt56uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt56u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt56u() : ReadAttribute("nullable-int56u") {} + + ~ReadUnitTestingNullableInt56u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400B) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt56uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt56u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt56u : public WriteAttribute { public: - WriteUnitTestingNullableInt56u() - : WriteAttribute("nullable-int56u") - { - AddArgument("attr-name", "nullable-int56u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt56u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeNullableInt56uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt56u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt56u() : WriteAttribute("nullable-int56u") { + AddArgument("attr-name", "nullable-int56u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt56u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeNullableInt56uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt56u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt56u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt56u() - : SubscribeAttribute("nullable-int56u") - { - } + SubscribeAttributeUnitTestingNullableInt56u() + : SubscribeAttribute("nullable-int56u") {} - ~SubscribeAttributeUnitTestingNullableInt56u() {} + ~SubscribeAttributeUnitTestingNullableInt56u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400B) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400B) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt56uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt56uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94639,109 +111758,129 @@ class SubscribeAttributeUnitTestingNullableInt56u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt64u : public ReadAttribute { public: - ReadUnitTestingNullableInt64u() - : ReadAttribute("nullable-int64u") - { - } - - ~ReadUnitTestingNullableInt64u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400C) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt64uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt64u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt64u() : ReadAttribute("nullable-int64u") {} + + ~ReadUnitTestingNullableInt64u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400C) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt64uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt64u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt64u : public WriteAttribute { public: - WriteUnitTestingNullableInt64u() - : WriteAttribute("nullable-int64u") - { - AddArgument("attr-name", "nullable-int64u"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt64u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; - - [cluster writeAttributeNullableInt64uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt64u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt64u() : WriteAttribute("nullable-int64u") { + AddArgument("attr-name", "nullable-int64u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt64u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedLongLong:mValue]; + + [cluster + writeAttributeNullableInt64uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt64u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint64_t mValue; + uint64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt64u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt64u() - : SubscribeAttribute("nullable-int64u") - { - } + SubscribeAttributeUnitTestingNullableInt64u() + : SubscribeAttribute("nullable-int64u") {} - ~SubscribeAttributeUnitTestingNullableInt64u() {} + ~SubscribeAttributeUnitTestingNullableInt64u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400C) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400C) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt64uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt64uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94749,109 +111888,129 @@ class SubscribeAttributeUnitTestingNullableInt64u : public SubscribeAttribute { */ class ReadUnitTestingNullableInt8s : public ReadAttribute { public: - ReadUnitTestingNullableInt8s() - : ReadAttribute("nullable-int8s") - { - } - - ~ReadUnitTestingNullableInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400D) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt8s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt8s() : ReadAttribute("nullable-int8s") {} + + ~ReadUnitTestingNullableInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400D) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt8sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt8s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt8s : public WriteAttribute { public: - WriteUnitTestingNullableInt8s() - : WriteAttribute("nullable-int8s") - { - AddArgument("attr-name", "nullable-int8s"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithChar:mValue]; - - [cluster writeAttributeNullableInt8sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt8s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt8s() : WriteAttribute("nullable-int8s") { + AddArgument("attr-name", "nullable-int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithChar:mValue]; + + [cluster + writeAttributeNullableInt8sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt8s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int8_t mValue; + int8_t mValue; }; class SubscribeAttributeUnitTestingNullableInt8s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt8s() - : SubscribeAttribute("nullable-int8s") - { - } + SubscribeAttributeUnitTestingNullableInt8s() + : SubscribeAttribute("nullable-int8s") {} - ~SubscribeAttributeUnitTestingNullableInt8s() {} + ~SubscribeAttributeUnitTestingNullableInt8s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400D) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400D) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt8sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt8sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94859,109 +112018,129 @@ class SubscribeAttributeUnitTestingNullableInt8s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt16s : public ReadAttribute { public: - ReadUnitTestingNullableInt16s() - : ReadAttribute("nullable-int16s") - { - } - - ~ReadUnitTestingNullableInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt16s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt16s() : ReadAttribute("nullable-int16s") {} + + ~ReadUnitTestingNullableInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt16sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt16s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt16s : public WriteAttribute { public: - WriteUnitTestingNullableInt16s() - : WriteAttribute("nullable-int16s") - { - AddArgument("attr-name", "nullable-int16s"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithShort:mValue]; - - [cluster writeAttributeNullableInt16sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt16s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt16s() : WriteAttribute("nullable-int16s") { + AddArgument("attr-name", "nullable-int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeNullableInt16sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt16s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int16_t mValue; + int16_t mValue; }; class SubscribeAttributeUnitTestingNullableInt16s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt16s() - : SubscribeAttribute("nullable-int16s") - { - } + SubscribeAttributeUnitTestingNullableInt16s() + : SubscribeAttribute("nullable-int16s") {} - ~SubscribeAttributeUnitTestingNullableInt16s() {} + ~SubscribeAttributeUnitTestingNullableInt16s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt16sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt16sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -94969,109 +112148,129 @@ class SubscribeAttributeUnitTestingNullableInt16s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt24s : public ReadAttribute { public: - ReadUnitTestingNullableInt24s() - : ReadAttribute("nullable-int24s") - { - } - - ~ReadUnitTestingNullableInt24s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400F) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt24sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt24s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt24s() : ReadAttribute("nullable-int24s") {} + + ~ReadUnitTestingNullableInt24s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000400F) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt24sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt24s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt24s : public WriteAttribute { public: - WriteUnitTestingNullableInt24s() - : WriteAttribute("nullable-int24s") - { - AddArgument("attr-name", "nullable-int24s"); - AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt24s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithInt:mValue]; - - [cluster writeAttributeNullableInt24sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt24s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt24s() : WriteAttribute("nullable-int24s") { + AddArgument("attr-name", "nullable-int24s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt24s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000400F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithInt:mValue]; + + [cluster + writeAttributeNullableInt24sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt24s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int32_t mValue; + int32_t mValue; }; class SubscribeAttributeUnitTestingNullableInt24s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt24s() - : SubscribeAttribute("nullable-int24s") - { - } + SubscribeAttributeUnitTestingNullableInt24s() + : SubscribeAttribute("nullable-int24s") {} - ~SubscribeAttributeUnitTestingNullableInt24s() {} + ~SubscribeAttributeUnitTestingNullableInt24s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400F) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000400F) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt24sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt24sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95079,109 +112278,129 @@ class SubscribeAttributeUnitTestingNullableInt24s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt32s : public ReadAttribute { public: - ReadUnitTestingNullableInt32s() - : ReadAttribute("nullable-int32s") - { - } - - ~ReadUnitTestingNullableInt32s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004010) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt32sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt32s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt32s() : ReadAttribute("nullable-int32s") {} + + ~ReadUnitTestingNullableInt32s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004010) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt32sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt32s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt32s : public WriteAttribute { public: - WriteUnitTestingNullableInt32s() - : WriteAttribute("nullable-int32s") - { - AddArgument("attr-name", "nullable-int32s"); - AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt32s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithInt:mValue]; - - [cluster writeAttributeNullableInt32sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt32s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt32s() : WriteAttribute("nullable-int32s") { + AddArgument("attr-name", "nullable-int32s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt32s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithInt:mValue]; + + [cluster + writeAttributeNullableInt32sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt32s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int32_t mValue; + int32_t mValue; }; class SubscribeAttributeUnitTestingNullableInt32s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt32s() - : SubscribeAttribute("nullable-int32s") - { - } + SubscribeAttributeUnitTestingNullableInt32s() + : SubscribeAttribute("nullable-int32s") {} - ~SubscribeAttributeUnitTestingNullableInt32s() {} + ~SubscribeAttributeUnitTestingNullableInt32s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004010) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004010) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt32sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt32sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95189,109 +112408,129 @@ class SubscribeAttributeUnitTestingNullableInt32s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt40s : public ReadAttribute { public: - ReadUnitTestingNullableInt40s() - : ReadAttribute("nullable-int40s") - { - } - - ~ReadUnitTestingNullableInt40s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004011) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt40sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt40s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt40s() : ReadAttribute("nullable-int40s") {} + + ~ReadUnitTestingNullableInt40s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004011) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt40sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt40s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt40s : public WriteAttribute { public: - WriteUnitTestingNullableInt40s() - : WriteAttribute("nullable-int40s") - { - AddArgument("attr-name", "nullable-int40s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt40s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeNullableInt40sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt40s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt40s() : WriteAttribute("nullable-int40s") { + AddArgument("attr-name", "nullable-int40s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt40s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithLongLong:mValue]; + + [cluster + writeAttributeNullableInt40sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt40s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt40s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt40s() - : SubscribeAttribute("nullable-int40s") - { - } + SubscribeAttributeUnitTestingNullableInt40s() + : SubscribeAttribute("nullable-int40s") {} - ~SubscribeAttributeUnitTestingNullableInt40s() {} + ~SubscribeAttributeUnitTestingNullableInt40s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004011) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004011) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt40sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt40sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95299,109 +112538,129 @@ class SubscribeAttributeUnitTestingNullableInt40s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt48s : public ReadAttribute { public: - ReadUnitTestingNullableInt48s() - : ReadAttribute("nullable-int48s") - { - } - - ~ReadUnitTestingNullableInt48s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004012) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt48sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt48s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt48s() : ReadAttribute("nullable-int48s") {} + + ~ReadUnitTestingNullableInt48s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004012) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt48sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt48s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt48s : public WriteAttribute { public: - WriteUnitTestingNullableInt48s() - : WriteAttribute("nullable-int48s") - { - AddArgument("attr-name", "nullable-int48s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt48s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeNullableInt48sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt48s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt48s() : WriteAttribute("nullable-int48s") { + AddArgument("attr-name", "nullable-int48s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt48s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithLongLong:mValue]; + + [cluster + writeAttributeNullableInt48sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt48s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt48s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt48s() - : SubscribeAttribute("nullable-int48s") - { - } + SubscribeAttributeUnitTestingNullableInt48s() + : SubscribeAttribute("nullable-int48s") {} - ~SubscribeAttributeUnitTestingNullableInt48s() {} + ~SubscribeAttributeUnitTestingNullableInt48s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004012) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004012) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt48sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt48sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95409,109 +112668,129 @@ class SubscribeAttributeUnitTestingNullableInt48s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt56s : public ReadAttribute { public: - ReadUnitTestingNullableInt56s() - : ReadAttribute("nullable-int56s") - { - } - - ~ReadUnitTestingNullableInt56s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004013) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt56sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt56s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt56s() : ReadAttribute("nullable-int56s") {} + + ~ReadUnitTestingNullableInt56s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004013) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt56sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt56s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt56s : public WriteAttribute { public: - WriteUnitTestingNullableInt56s() - : WriteAttribute("nullable-int56s") - { - AddArgument("attr-name", "nullable-int56s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt56s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeNullableInt56sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt56s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt56s() : WriteAttribute("nullable-int56s") { + AddArgument("attr-name", "nullable-int56s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt56s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithLongLong:mValue]; + + [cluster + writeAttributeNullableInt56sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt56s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt56s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt56s() - : SubscribeAttribute("nullable-int56s") - { - } + SubscribeAttributeUnitTestingNullableInt56s() + : SubscribeAttribute("nullable-int56s") {} - ~SubscribeAttributeUnitTestingNullableInt56s() {} + ~SubscribeAttributeUnitTestingNullableInt56s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004013) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004013) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt56sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt56sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95519,109 +112798,129 @@ class SubscribeAttributeUnitTestingNullableInt56s : public SubscribeAttribute { */ class ReadUnitTestingNullableInt64s : public ReadAttribute { public: - ReadUnitTestingNullableInt64s() - : ReadAttribute("nullable-int64s") - { - } - - ~ReadUnitTestingNullableInt64s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004014) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableInt64sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableInt64s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableInt64s() : ReadAttribute("nullable-int64s") {} + + ~ReadUnitTestingNullableInt64s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004014) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableInt64sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableInt64s read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableInt64s : public WriteAttribute { public: - WriteUnitTestingNullableInt64s() - : WriteAttribute("nullable-int64s") - { - AddArgument("attr-name", "nullable-int64s"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableInt64s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithLongLong:mValue]; - - [cluster writeAttributeNullableInt64sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableInt64s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableInt64s() : WriteAttribute("nullable-int64s") { + AddArgument("attr-name", "nullable-int64s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableInt64s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithLongLong:mValue]; + + [cluster + writeAttributeNullableInt64sWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableInt64s " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int64_t mValue; + int64_t mValue; }; class SubscribeAttributeUnitTestingNullableInt64s : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableInt64s() - : SubscribeAttribute("nullable-int64s") - { - } + SubscribeAttributeUnitTestingNullableInt64s() + : SubscribeAttribute("nullable-int64s") {} - ~SubscribeAttributeUnitTestingNullableInt64s() {} + ~SubscribeAttributeUnitTestingNullableInt64s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004014) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004014) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableInt64sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableInt64sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95629,109 +112928,129 @@ class SubscribeAttributeUnitTestingNullableInt64s : public SubscribeAttribute { */ class ReadUnitTestingNullableEnum8 : public ReadAttribute { public: - ReadUnitTestingNullableEnum8() - : ReadAttribute("nullable-enum8") - { - } - - ~ReadUnitTestingNullableEnum8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004015) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableEnum8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableEnum8 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableEnum8() : ReadAttribute("nullable-enum8") {} + + ~ReadUnitTestingNullableEnum8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004015) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableEnum8WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableEnum8 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableEnum8 : public WriteAttribute { public: - WriteUnitTestingNullableEnum8() - : WriteAttribute("nullable-enum8") - { - AddArgument("attr-name", "nullable-enum8"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableEnum8() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeNullableEnum8WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableEnum8 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableEnum8() : WriteAttribute("nullable-enum8") { + AddArgument("attr-name", "nullable-enum8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableEnum8() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeNullableEnum8WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableEnum8 " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingNullableEnum8 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableEnum8() - : SubscribeAttribute("nullable-enum8") - { - } + SubscribeAttributeUnitTestingNullableEnum8() + : SubscribeAttribute("nullable-enum8") {} - ~SubscribeAttributeUnitTestingNullableEnum8() {} + ~SubscribeAttributeUnitTestingNullableEnum8() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004015) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004015) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableEnum8WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableEnum8WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95739,109 +113058,129 @@ class SubscribeAttributeUnitTestingNullableEnum8 : public SubscribeAttribute { */ class ReadUnitTestingNullableEnum16 : public ReadAttribute { public: - ReadUnitTestingNullableEnum16() - : ReadAttribute("nullable-enum16") - { - } - - ~ReadUnitTestingNullableEnum16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004016) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableEnum16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableEnum16 read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableEnum16() : ReadAttribute("nullable-enum16") {} + + ~ReadUnitTestingNullableEnum16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004016) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableEnum16WithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableEnum16 read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableEnum16 : public WriteAttribute { public: - WriteUnitTestingNullableEnum16() - : WriteAttribute("nullable-enum16") - { - AddArgument("attr-name", "nullable-enum16"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableEnum16() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster writeAttributeNullableEnum16WithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableEnum16 write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableEnum16() : WriteAttribute("nullable-enum16") { + AddArgument("attr-name", "nullable-enum16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableEnum16() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeNullableEnum16WithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableEnum16 " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; class SubscribeAttributeUnitTestingNullableEnum16 : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableEnum16() - : SubscribeAttribute("nullable-enum16") - { - } + SubscribeAttributeUnitTestingNullableEnum16() + : SubscribeAttribute("nullable-enum16") {} - ~SubscribeAttributeUnitTestingNullableEnum16() {} + ~SubscribeAttributeUnitTestingNullableEnum16() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004016) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004016) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableEnum16WithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableEnum16WithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95849,109 +113188,136 @@ class SubscribeAttributeUnitTestingNullableEnum16 : public SubscribeAttribute { */ class ReadUnitTestingNullableFloatSingle : public ReadAttribute { public: - ReadUnitTestingNullableFloatSingle() - : ReadAttribute("nullable-float-single") - { - } - - ~ReadUnitTestingNullableFloatSingle() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004017) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableFloatSingleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableFloatSingle response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableFloatSingle read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableFloatSingle() + : ReadAttribute("nullable-float-single") {} + + ~ReadUnitTestingNullableFloatSingle() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004017) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableFloatSingleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableFloatSingle response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableFloatSingle read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableFloatSingle : public WriteAttribute { public: - WriteUnitTestingNullableFloatSingle() - : WriteAttribute("nullable-float-single") - { - AddArgument("attr-name", "nullable-float-single"); - AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableFloatSingle() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithFloat:mValue]; - - [cluster writeAttributeNullableFloatSingleWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableFloatSingle write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableFloatSingle() + : WriteAttribute("nullable-float-single") { + AddArgument("attr-name", "nullable-float-single"); + AddArgument("attr-value", -std::numeric_limits::infinity(), + std::numeric_limits::infinity(), &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableFloatSingle() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithFloat:mValue]; + + [cluster + writeAttributeNullableFloatSingleWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "NullableFloatSingle " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - float mValue; + float mValue; }; -class SubscribeAttributeUnitTestingNullableFloatSingle : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableFloatSingle + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableFloatSingle() - : SubscribeAttribute("nullable-float-single") - { - } + SubscribeAttributeUnitTestingNullableFloatSingle() + : SubscribeAttribute("nullable-float-single") {} - ~SubscribeAttributeUnitTestingNullableFloatSingle() {} + ~SubscribeAttributeUnitTestingNullableFloatSingle() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004017) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004017) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableFloatSingleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableFloatSingleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableFloatSingle response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableFloatSingle response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -95959,109 +113325,136 @@ class SubscribeAttributeUnitTestingNullableFloatSingle : public SubscribeAttribu */ class ReadUnitTestingNullableFloatDouble : public ReadAttribute { public: - ReadUnitTestingNullableFloatDouble() - : ReadAttribute("nullable-float-double") - { - } - - ~ReadUnitTestingNullableFloatDouble() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004018) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableFloatDoubleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableFloatDouble response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableFloatDouble read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableFloatDouble() + : ReadAttribute("nullable-float-double") {} + + ~ReadUnitTestingNullableFloatDouble() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004018) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableFloatDoubleWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableFloatDouble response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableFloatDouble read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableFloatDouble : public WriteAttribute { public: - WriteUnitTestingNullableFloatDouble() - : WriteAttribute("nullable-float-double") - { - AddArgument("attr-name", "nullable-float-double"); - AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableFloatDouble() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithDouble:mValue]; - - [cluster writeAttributeNullableFloatDoubleWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableFloatDouble write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableFloatDouble() + : WriteAttribute("nullable-float-double") { + AddArgument("attr-name", "nullable-float-double"); + AddArgument("attr-value", -std::numeric_limits::infinity(), + std::numeric_limits::infinity(), &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableFloatDouble() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithDouble:mValue]; + + [cluster + writeAttributeNullableFloatDoubleWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "NullableFloatDouble " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - double mValue; + double mValue; }; -class SubscribeAttributeUnitTestingNullableFloatDouble : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableFloatDouble + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableFloatDouble() - : SubscribeAttribute("nullable-float-double") - { - } + SubscribeAttributeUnitTestingNullableFloatDouble() + : SubscribeAttribute("nullable-float-double") {} - ~SubscribeAttributeUnitTestingNullableFloatDouble() {} + ~SubscribeAttributeUnitTestingNullableFloatDouble() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004018) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004018) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableFloatDoubleWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableFloatDoubleWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableFloatDouble response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableFloatDouble response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96069,109 +113462,136 @@ class SubscribeAttributeUnitTestingNullableFloatDouble : public SubscribeAttribu */ class ReadUnitTestingNullableOctetString : public ReadAttribute { public: - ReadUnitTestingNullableOctetString() - : ReadAttribute("nullable-octet-string") - { - } - - ~ReadUnitTestingNullableOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004019) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableOctetString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableOctetString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableOctetString() + : ReadAttribute("nullable-octet-string") {} + + ~ReadUnitTestingNullableOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004019) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableOctetStringWithCompletion:^( + NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableOctetString response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableOctetString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableOctetString : public WriteAttribute { public: - WriteUnitTestingNullableOctetString() - : WriteAttribute("nullable-octet-string") - { - AddArgument("attr-name", "nullable-octet-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableOctetString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSData * _Nullable value = [[NSData alloc] initWithBytes:mValue.data() length:mValue.size()]; - - [cluster writeAttributeNullableOctetStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableOctetString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableOctetString() + : WriteAttribute("nullable-octet-string") { + AddArgument("attr-name", "nullable-octet-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableOctetString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSData *_Nullable value = [[NSData alloc] initWithBytes:mValue.data() + length:mValue.size()]; + + [cluster + writeAttributeNullableOctetStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting " + "NullableOctetString " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; -class SubscribeAttributeUnitTestingNullableOctetString : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableOctetString + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableOctetString() - : SubscribeAttribute("nullable-octet-string") - { - } + SubscribeAttributeUnitTestingNullableOctetString() + : SubscribeAttribute("nullable-octet-string") {} - ~SubscribeAttributeUnitTestingNullableOctetString() {} + ~SubscribeAttributeUnitTestingNullableOctetString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004019) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004019) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableOctetStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableOctetStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableOctetString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSData *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableOctetString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96179,111 +113599,136 @@ class SubscribeAttributeUnitTestingNullableOctetString : public SubscribeAttribu */ class ReadUnitTestingNullableCharString : public ReadAttribute { public: - ReadUnitTestingNullableCharString() - : ReadAttribute("nullable-char-string") - { - } - - ~ReadUnitTestingNullableCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000401E) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableCharString response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableCharString read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableCharString() : ReadAttribute("nullable-char-string") {} + + ~ReadUnitTestingNullableCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000401E) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableCharStringWithCompletion:^( + NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableCharString response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableCharString read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableCharString : public WriteAttribute { public: - WriteUnitTestingNullableCharString() - : WriteAttribute("nullable-char-string") - { - AddArgument("attr-name", "nullable-char-string"); - AddArgument("attr-value", &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableCharString() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000401E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSString * _Nullable value = [[NSString alloc] initWithBytes:mValue.data() - length:mValue.size() - encoding:NSUTF8StringEncoding]; - - [cluster writeAttributeNullableCharStringWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableCharString write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableCharString() + : WriteAttribute("nullable-char-string") { + AddArgument("attr-name", "nullable-char-string"); + AddArgument("attr-value", &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableCharString() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000401E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSString *_Nullable value = + [[NSString alloc] initWithBytes:mValue.data() + length:mValue.size() + encoding:NSUTF8StringEncoding]; + + [cluster + writeAttributeNullableCharStringWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableCharString " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - chip::ByteSpan mValue; + chip::ByteSpan mValue; }; -class SubscribeAttributeUnitTestingNullableCharString : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableCharString + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableCharString() - : SubscribeAttribute("nullable-char-string") - { - } + SubscribeAttributeUnitTestingNullableCharString() + : SubscribeAttribute("nullable-char-string") {} - ~SubscribeAttributeUnitTestingNullableCharString() {} + ~SubscribeAttributeUnitTestingNullableCharString() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000401E) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000401E) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableCharStringWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableCharStringWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableCharString response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSString *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableCharString response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96291,109 +113736,132 @@ class SubscribeAttributeUnitTestingNullableCharString : public SubscribeAttribut */ class ReadUnitTestingNullableEnumAttr : public ReadAttribute { public: - ReadUnitTestingNullableEnumAttr() - : ReadAttribute("nullable-enum-attr") - { - } - - ~ReadUnitTestingNullableEnumAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004024) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableEnumAttrWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnumAttr response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableEnumAttr read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableEnumAttr() : ReadAttribute("nullable-enum-attr") {} + + ~ReadUnitTestingNullableEnumAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004024) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableEnumAttrWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnumAttr response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableEnumAttr read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableEnumAttr : public WriteAttribute { public: - WriteUnitTestingNullableEnumAttr() - : WriteAttribute("nullable-enum-attr") - { - AddArgument("attr-name", "nullable-enum-attr"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableEnumAttr() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeNullableEnumAttrWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableEnumAttr write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableEnumAttr() : WriteAttribute("nullable-enum-attr") { + AddArgument("attr-name", "nullable-enum-attr"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableEnumAttr() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeNullableEnumAttrWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting NullableEnumAttr " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeUnitTestingNullableEnumAttr : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableEnumAttr + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableEnumAttr() - : SubscribeAttribute("nullable-enum-attr") - { - } + SubscribeAttributeUnitTestingNullableEnumAttr() + : SubscribeAttribute("nullable-enum-attr") {} - ~SubscribeAttributeUnitTestingNullableEnumAttr() {} + ~SubscribeAttributeUnitTestingNullableEnumAttr() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004024) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeNullableEnumAttrWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableEnumAttr response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004024) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); } + [cluster subscribeAttributeNullableEnumAttrWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableEnumAttr response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -96401,127 +113869,154 @@ class SubscribeAttributeUnitTestingNullableEnumAttr : public SubscribeAttribute */ class ReadUnitTestingNullableStruct : public ReadAttribute { public: - ReadUnitTestingNullableStruct() - : ReadAttribute("nullable-struct") - { - } - - ~ReadUnitTestingNullableStruct() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004025) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableStructWithCompletion:^( - MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableStruct response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableStruct read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableStruct() : ReadAttribute("nullable-struct") {} + + ~ReadUnitTestingNullableStruct() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004025) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableStructWithCompletion:^( + MTRUnitTestingClusterSimpleStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableStruct response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableStruct read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableStruct : public WriteAttribute { public: - WriteUnitTestingNullableStruct() - : WriteAttribute("nullable-struct") - , mComplex(&mValue) - { - AddArgument("attr-name", "nullable-struct"); - AddArgument("attr-value", &mComplex); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableStruct() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - MTRUnitTestingClusterSimpleStruct * _Nullable value; - if (mValue.IsNull()) { - value = nil; - } else { - value = [MTRUnitTestingClusterSimpleStruct new]; - value.a = [NSNumber numberWithUnsignedChar:mValue.Value().a]; - value.b = [NSNumber numberWithBool:mValue.Value().b]; - value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().c)]; - value.d = [NSData dataWithBytes:mValue.Value().d.data() length:mValue.Value().d.size()]; - value.e = [[NSString alloc] initWithBytes:mValue.Value().e.data() - length:mValue.Value().e.size() - encoding:NSUTF8StringEncoding]; - value.f = [NSNumber numberWithUnsignedChar:mValue.Value().f.Raw()]; - value.g = [NSNumber numberWithFloat:mValue.Value().g]; - value.h = [NSNumber numberWithDouble:mValue.Value().h]; - } - - [cluster writeAttributeNullableStructWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableStruct write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; + WriteUnitTestingNullableStruct() + : WriteAttribute("nullable-struct"), mComplex(&mValue) { + AddArgument("attr-name", "nullable-struct"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableStruct() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + MTRUnitTestingClusterSimpleStruct *_Nullable value; + if (mValue.IsNull()) { + value = nil; + } else { + value = [MTRUnitTestingClusterSimpleStruct new]; + value.a = [NSNumber numberWithUnsignedChar:mValue.Value().a]; + value.b = [NSNumber numberWithBool:mValue.Value().b]; + value.c = [NSNumber + numberWithUnsignedChar:chip::to_underlying(mValue.Value().c)]; + value.d = [NSData dataWithBytes:mValue.Value().d.data() + length:mValue.Value().d.size()]; + value.e = [[NSString alloc] initWithBytes:mValue.Value().e.data() + length:mValue.Value().e.size() + encoding:NSUTF8StringEncoding]; + value.f = [NSNumber numberWithUnsignedChar:mValue.Value().f.Raw()]; + value.g = [NSNumber numberWithFloat:mValue.Value().g]; + value.h = [NSNumber numberWithDouble:mValue.Value().h]; } + [cluster + writeAttributeNullableStructWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableStruct " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + private: - chip::app::DataModel::Nullable mValue; - TypedComplexArgument> mComplex; + chip::app::DataModel::Nullable< + chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type> + mValue; + TypedComplexArgument> + mComplex; }; class SubscribeAttributeUnitTestingNullableStruct : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableStruct() - : SubscribeAttribute("nullable-struct") - { - } + SubscribeAttributeUnitTestingNullableStruct() + : SubscribeAttribute("nullable-struct") {} - ~SubscribeAttributeUnitTestingNullableStruct() {} + ~SubscribeAttributeUnitTestingNullableStruct() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004025) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004025) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableStructWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableStructWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableStruct response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(MTRUnitTestingClusterSimpleStruct *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableStruct response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96529,110 +114024,138 @@ class SubscribeAttributeUnitTestingNullableStruct : public SubscribeAttribute { */ class ReadUnitTestingNullableRangeRestrictedInt8u : public ReadAttribute { public: - ReadUnitTestingNullableRangeRestrictedInt8u() - : ReadAttribute("nullable-range-restricted-int8u") - { - } - - ~ReadUnitTestingNullableRangeRestrictedInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004026) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableRangeRestrictedInt8u() + : ReadAttribute("nullable-range-restricted-int8u") {} + + ~ReadUnitTestingNullableRangeRestrictedInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004026) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableRangeRestrictedInt8uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableRangeRestrictedInt8u read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableRangeRestrictedInt8u : public WriteAttribute { public: - WriteUnitTestingNullableRangeRestrictedInt8u() - : WriteAttribute("nullable-range-restricted-int8u") - { - AddArgument("attr-name", "nullable-range-restricted-int8u"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableRangeRestrictedInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt8u write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableRangeRestrictedInt8u() + : WriteAttribute("nullable-range-restricted-int8u") { + AddArgument("attr-name", "nullable-range-restricted-int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableRangeRestrictedInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeNullableRangeRestrictedInt8uWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting " + "NullableRangeRestrict" + "edInt8u write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; -class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() - : SubscribeAttribute("nullable-range-restricted-int8u") - { - } + SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() + : SubscribeAttribute("nullable-range-restricted-int8u") {} - ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() {} + ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004026) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004026) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableRangeRestrictedInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableRangeRestrictedInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96640,110 +114163,138 @@ class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u : public Subscri */ class ReadUnitTestingNullableRangeRestrictedInt8s : public ReadAttribute { public: - ReadUnitTestingNullableRangeRestrictedInt8s() - : ReadAttribute("nullable-range-restricted-int8s") - { - } - - ~ReadUnitTestingNullableRangeRestrictedInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004027) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt8s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableRangeRestrictedInt8s() + : ReadAttribute("nullable-range-restricted-int8s") {} + + ~ReadUnitTestingNullableRangeRestrictedInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004027) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableRangeRestrictedInt8sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableRangeRestrictedInt8s read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableRangeRestrictedInt8s : public WriteAttribute { public: - WriteUnitTestingNullableRangeRestrictedInt8s() - : WriteAttribute("nullable-range-restricted-int8s") - { - AddArgument("attr-name", "nullable-range-restricted-int8s"); - AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableRangeRestrictedInt8s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithChar:mValue]; - - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt8s write Error", - error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableRangeRestrictedInt8s() + : WriteAttribute("nullable-range-restricted-int8s") { + AddArgument("attr-name", "nullable-range-restricted-int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableRangeRestrictedInt8s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithChar:mValue]; + + [cluster + writeAttributeNullableRangeRestrictedInt8sWithValue:value + params:params + completion:^( + NSError *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting " + "NullableRangeRestrict" + "edInt8s write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int8_t mValue; + int8_t mValue; }; -class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() - : SubscribeAttribute("nullable-range-restricted-int8s") - { - } + SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() + : SubscribeAttribute("nullable-range-restricted-int8s") {} - ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() {} + ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004027) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004027) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableRangeRestrictedInt8sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableRangeRestrictedInt8sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96751,111 +114302,140 @@ class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s : public Subscri */ class ReadUnitTestingNullableRangeRestrictedInt16u : public ReadAttribute { public: - ReadUnitTestingNullableRangeRestrictedInt16u() - : ReadAttribute("nullable-range-restricted-int16u") - { - } - - ~ReadUnitTestingNullableRangeRestrictedInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004028) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableRangeRestrictedInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt16u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableRangeRestrictedInt16u() + : ReadAttribute("nullable-range-restricted-int16u") {} + + ~ReadUnitTestingNullableRangeRestrictedInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004028) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableRangeRestrictedInt16uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableRangeRestrictedInt16u read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableRangeRestrictedInt16u : public WriteAttribute { public: - WriteUnitTestingNullableRangeRestrictedInt16u() - : WriteAttribute("nullable-range-restricted-int16u") - { - AddArgument("attr-name", "nullable-range-restricted-int16u"); - AddArgument("attr-value", 0, UINT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableRangeRestrictedInt16u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithUnsignedShort:mValue]; - - [cluster - writeAttributeNullableRangeRestrictedInt16uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "UnitTesting NullableRangeRestrictedInt16u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableRangeRestrictedInt16u() + : WriteAttribute("nullable-range-restricted-int16u") { + AddArgument("attr-name", "nullable-range-restricted-int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableRangeRestrictedInt16u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster + writeAttributeNullableRangeRestrictedInt16uWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting " + "NullableRangeRestric" + "tedInt16u write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint16_t mValue; + uint16_t mValue; }; -class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() - : SubscribeAttribute("nullable-range-restricted-int16u") - { - } + SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() + : SubscribeAttribute("nullable-range-restricted-int16u") {} - ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() {} + ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004028) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004028) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableRangeRestrictedInt16uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableRangeRestrictedInt16uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96863,111 +114443,140 @@ class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u : public Subscr */ class ReadUnitTestingNullableRangeRestrictedInt16s : public ReadAttribute { public: - ReadUnitTestingNullableRangeRestrictedInt16s() - : ReadAttribute("nullable-range-restricted-int16s") - { - } - - ~ReadUnitTestingNullableRangeRestrictedInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004029) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeNullableRangeRestrictedInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting NullableRangeRestrictedInt16s read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingNullableRangeRestrictedInt16s() + : ReadAttribute("nullable-range-restricted-int16s") {} + + ~ReadUnitTestingNullableRangeRestrictedInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x00004029) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeNullableRangeRestrictedInt16sWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting NullableRangeRestrictedInt16s read Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingNullableRangeRestrictedInt16s : public WriteAttribute { public: - WriteUnitTestingNullableRangeRestrictedInt16s() - : WriteAttribute("nullable-range-restricted-int16s") - { - AddArgument("attr-name", "nullable-range-restricted-int16s"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingNullableRangeRestrictedInt16s() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nullable value = [NSNumber numberWithShort:mValue]; - - [cluster - writeAttributeNullableRangeRestrictedInt16sWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError( - "UnitTesting NullableRangeRestrictedInt16s write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingNullableRangeRestrictedInt16s() + : WriteAttribute("nullable-range-restricted-int16s") { + AddArgument("attr-name", "nullable-range-restricted-int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableRangeRestrictedInt16s() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x00004029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nullable value = [NSNumber numberWithShort:mValue]; + + [cluster + writeAttributeNullableRangeRestrictedInt16sWithValue:value + params:params + completion:^( + NSError + *_Nullable error) { + if (error != nil) { + LogNSError( + "UnitTesting " + "NullableRangeRestric" + "tedInt16s write " + "Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - int16_t mValue; + int16_t mValue; }; -class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s : public SubscribeAttribute { +class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s + : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() - : SubscribeAttribute("nullable-range-restricted-int16s") - { - } + SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() + : SubscribeAttribute("nullable-range-restricted-int16s") {} - ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() {} + ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004029) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x00004029) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNullableRangeRestrictedInt16sWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeNullableRangeRestrictedInt16sWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -96975,109 +114584,129 @@ class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s : public Subscr */ class ReadUnitTestingWriteOnlyInt8u : public ReadAttribute { public: - ReadUnitTestingWriteOnlyInt8u() - : ReadAttribute("write-only-int8u") - { - } - - ~ReadUnitTestingWriteOnlyInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000402A) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeWriteOnlyInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting WriteOnlyInt8u read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingWriteOnlyInt8u() : ReadAttribute("write-only-int8u") {} + + ~ReadUnitTestingWriteOnlyInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000402A) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeWriteOnlyInt8uWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting WriteOnlyInt8u read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class WriteUnitTestingWriteOnlyInt8u : public WriteAttribute { public: - WriteUnitTestingWriteOnlyInt8u() - : WriteAttribute("write-only-int8u") - { - AddArgument("attr-name", "write-only-int8u"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteUnitTestingWriteOnlyInt8u() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000402A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout - = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeWriteOnlyInt8uWithValue:value - params:params - completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("UnitTesting WriteOnlyInt8u write Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + WriteUnitTestingWriteOnlyInt8u() : WriteAttribute("write-only-int8u") { + AddArgument("attr-name", "write-only-int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingWriteOnlyInt8u() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) WriteAttribute (0x0000402A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = + mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber + numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + params.dataVersion = + mDataVersion.HasValue() + ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] + : nil; + NSNumber *_Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster + writeAttributeWriteOnlyInt8uWithValue:value + params:params + completion:^(NSError *_Nullable error) { + if (error != nil) { + LogNSError("UnitTesting WriteOnlyInt8u " + "write Error", + error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } private: - uint8_t mValue; + uint8_t mValue; }; class SubscribeAttributeUnitTestingWriteOnlyInt8u : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingWriteOnlyInt8u() - : SubscribeAttribute("write-only-int8u") - { - } + SubscribeAttributeUnitTestingWriteOnlyInt8u() + : SubscribeAttribute("write-only-int8u") {} - ~SubscribeAttributeUnitTestingWriteOnlyInt8u() {} + ~SubscribeAttributeUnitTestingWriteOnlyInt8u() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000402A) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000402A) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWriteOnlyInt8uWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeWriteOnlyInt8uWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -97085,69 +114714,81 @@ class SubscribeAttributeUnitTestingWriteOnlyInt8u : public SubscribeAttribute { */ class ReadUnitTestingGeneratedCommandList : public ReadAttribute { public: - ReadUnitTestingGeneratedCommandList() - : ReadAttribute("generated-command-list") - { - } - - ~ReadUnitTestingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.GeneratedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting GeneratedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitTestingGeneratedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeUnitTestingGeneratedCommandList() - : SubscribeAttribute("generated-command-list") - { - } - - ~SubscribeAttributeUnitTestingGeneratedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeGeneratedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadUnitTestingGeneratedCommandList() + : ReadAttribute("generated-command-list") {} + + ~ReadUnitTestingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.GeneratedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitTestingGeneratedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingGeneratedCommandList() + : SubscribeAttribute("generated-command-list") {} + + ~SubscribeAttributeUnitTestingGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFF8) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.GeneratedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -97155,69 +114796,81 @@ class SubscribeAttributeUnitTestingGeneratedCommandList : public SubscribeAttrib */ class ReadUnitTestingAcceptedCommandList : public ReadAttribute { public: - ReadUnitTestingAcceptedCommandList() - : ReadAttribute("accepted-command-list") - { - } - - ~ReadUnitTestingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.AcceptedCommandList response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting AcceptedCommandList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeUnitTestingAcceptedCommandList : public SubscribeAttribute { -public: - SubscribeAttributeUnitTestingAcceptedCommandList() - : SubscribeAttribute("accepted-command-list") - { - } - - ~SubscribeAttributeUnitTestingAcceptedCommandList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeAcceptedCommandListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } + ReadUnitTestingAcceptedCommandList() + : ReadAttribute("accepted-command-list") {} + + ~ReadUnitTestingAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.AcceptedCommandList response %@", + [value description]); + if (error != nil) { + LogNSError("UnitTesting AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeUnitTestingAcceptedCommandList + : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") {} + + ~SubscribeAttributeUnitTestingAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFF9) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.AcceptedCommandList response %@", + [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } }; /* @@ -97225,69 +114878,77 @@ class SubscribeAttributeUnitTestingAcceptedCommandList : public SubscribeAttribu */ class ReadUnitTestingAttributeList : public ReadAttribute { public: - ReadUnitTestingAttributeList() - : ReadAttribute("attribute-list") - { - } - - ~ReadUnitTestingAttributeList() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.AttributeList response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting AttributeList read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingAttributeList() : ReadAttribute("attribute-list") {} + + ~ReadUnitTestingAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^( + NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeUnitTestingAttributeList : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingAttributeList() - : SubscribeAttribute("attribute-list") - { - } + SubscribeAttributeUnitTestingAttributeList() + : SubscribeAttribute("attribute-list") {} - ~SubscribeAttributeUnitTestingAttributeList() {} + ~SubscribeAttributeUnitTestingAttributeList() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFB) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeAttributeListWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.AttributeList response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSArray *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -97295,69 +114956,77 @@ class SubscribeAttributeUnitTestingAttributeList : public SubscribeAttribute { */ class ReadUnitTestingFeatureMap : public ReadAttribute { public: - ReadUnitTestingFeatureMap() - : ReadAttribute("feature-map") - { - } - - ~ReadUnitTestingFeatureMap() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FeatureMap response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting FeatureMap read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingFeatureMap() : ReadAttribute("feature-map") {} + + ~ReadUnitTestingFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber *_Nullable value, + NSError *_Nullable error) { + NSLog(@"UnitTesting.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeUnitTestingFeatureMap : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingFeatureMap() - : SubscribeAttribute("feature-map") - { - } + SubscribeAttributeUnitTestingFeatureMap() + : SubscribeAttribute("feature-map") {} - ~SubscribeAttributeUnitTestingFeatureMap() {} + ~SubscribeAttributeUnitTestingFeatureMap() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFC) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeFeatureMapWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.FeatureMap response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /* @@ -97365,3715 +115034,4012 @@ class SubscribeAttributeUnitTestingFeatureMap : public SubscribeAttribute { */ class ReadUnitTestingClusterRevision : public ReadAttribute { public: - ReadUnitTestingClusterRevision() - : ReadAttribute("cluster-revision") - { - } - - ~ReadUnitTestingClusterRevision() {} - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ClusterRevision response %@", [value description]); - if (error != nil) { - LogNSError("UnitTesting ClusterRevision read Error", error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } + ReadUnitTestingClusterRevision() : ReadAttribute("cluster-revision") {} + + ~ReadUnitTestingClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReadAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^( + NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("UnitTesting ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeUnitTestingClusterRevision : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingClusterRevision() - : SubscribeAttribute("cluster-revision") - { - } + SubscribeAttributeUnitTestingClusterRevision() + : SubscribeAttribute("cluster-revision") {} - ~SubscribeAttributeUnitTestingClusterRevision() {} + ~SubscribeAttributeUnitTestingClusterRevision() {} - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device - endpointID:@(endpointId) - queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeIfLost = mAutoResubscribe.Value(); + CHIP_ERROR SendCommand(MTRBaseDevice *device, + chip::EndpointId endpointId) override { + ChipLogProgress(chipTool, + "Sending cluster (0xFFF1FC05) ReportAttribute (0x0000FFFD) " + "on endpoint %u", + endpointId); + dispatch_queue_t callbackQueue = + dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type *cluster = + [[MTRBaseClusterUnitTesting alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type *params = + [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) + maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; } - [cluster subscribeAttributeClusterRevisionWithParams:params - subscriptionEstablished:^() { - mSubscriptionEstablished = YES; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ClusterRevision response %@", [value description]); - SetCommandExitStatus(error); - }]; + reportHandler:^(NSNumber *_Nullable value, NSError *_Nullable error) { + NSLog(@"UnitTesting.ClusterRevision response %@", + [value description]); + SetCommandExitStatus(error); + }]; - return CHIP_NO_ERROR; - } + return CHIP_NO_ERROR; + } }; /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ -void registerClusterIdentify(Commands & commands) -{ - using namespace chip::app::Clusters::Identify; - - const char * clusterName = "Identify"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterIdentify(Commands &commands) { + using namespace chip::app::Clusters::Identify; + + const char *clusterName = "Identify"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterGroups(Commands & commands) -{ - using namespace chip::app::Clusters::Groups; - - const char * clusterName = "Groups"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterGroups(Commands &commands) { + using namespace chip::app::Clusters::Groups; + + const char *clusterName = "Groups"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterScenes(Commands & commands) -{ - using namespace chip::app::Clusters::Scenes; - - const char * clusterName = "Scenes"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterScenes(Commands &commands) { + using namespace chip::app::Clusters::Scenes; + + const char *clusterName = "Scenes"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOnOff(Commands & commands) -{ - using namespace chip::app::Clusters::OnOff; - - const char * clusterName = "OnOff"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOnOff(Commands &commands) { + using namespace chip::app::Clusters::OnOff; + + const char *clusterName = "OnOff"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOnOffSwitchConfiguration(Commands & commands) -{ - using namespace chip::app::Clusters::OnOffSwitchConfiguration; - - const char * clusterName = "OnOffSwitchConfiguration"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOnOffSwitchConfiguration(Commands &commands) { + using namespace chip::app::Clusters::OnOffSwitchConfiguration; + + const char *clusterName = "OnOffSwitchConfiguration"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOnOffSwitchConfigurationClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterLevelControl(Commands & commands) -{ - using namespace chip::app::Clusters::LevelControl; - - const char * clusterName = "LevelControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterLevelControl(Commands &commands) { + using namespace chip::app::Clusters::LevelControl; + + const char *clusterName = "LevelControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBinaryInputBasic(Commands & commands) -{ - using namespace chip::app::Clusters::BinaryInputBasic; - - const char * clusterName = "BinaryInputBasic"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBinaryInputBasic(Commands &commands) { + using namespace chip::app::Clusters::BinaryInputBasic; + + const char *clusterName = "BinaryInputBasic"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterDescriptor(Commands & commands) -{ - using namespace chip::app::Clusters::Descriptor; - - const char * clusterName = "Descriptor"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterDescriptor(Commands &commands) { + using namespace chip::app::Clusters::Descriptor; + + const char *clusterName = "Descriptor"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBinding(Commands & commands) -{ - using namespace chip::app::Clusters::Binding; - - const char * clusterName = "Binding"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBinding(Commands &commands) { + using namespace chip::app::Clusters::Binding; + + const char *clusterName = "Binding"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterAccessControl(Commands & commands) -{ - using namespace chip::app::Clusters::AccessControl; - - const char * clusterName = "AccessControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterAccessControl(Commands &commands) { + using namespace chip::app::Clusters::AccessControl; + + const char *clusterName = "AccessControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeAccessControlSubjectsPerAccessControlEntry>(), // + make_unique(), // + make_unique< + SubscribeAttributeAccessControlTargetsPerAccessControlEntry>(), // + make_unique(), // + make_unique< + SubscribeAttributeAccessControlAccessControlEntriesPerFabric>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterActions(Commands & commands) -{ - using namespace chip::app::Clusters::Actions; - - const char * clusterName = "Actions"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterActions(Commands &commands) { + using namespace chip::app::Clusters::Actions; + + const char *clusterName = "Actions"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBasicInformation(Commands & commands) -{ - using namespace chip::app::Clusters::BasicInformation; - - const char * clusterName = "BasicInformation"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBasicInformation(Commands &commands) { + using namespace chip::app::Clusters::BasicInformation; + + const char *clusterName = "BasicInformation"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOtaSoftwareUpdateProvider(Commands & commands) -{ - using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; - - const char * clusterName = "OtaSoftwareUpdateProvider"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOtaSoftwareUpdateProvider(Commands &commands) { + using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; + + const char *clusterName = "OtaSoftwareUpdateProvider"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateProviderAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOtaSoftwareUpdateRequestor(Commands & commands) -{ - using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; - - const char * clusterName = "OtaSoftwareUpdateRequestor"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOtaSoftwareUpdateRequestor(Commands &commands) { + using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; + + const char *clusterName = "OtaSoftwareUpdateRequestor"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision>(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterLocalizationConfiguration(Commands & commands) -{ - using namespace chip::app::Clusters::LocalizationConfiguration; - - const char * clusterName = "LocalizationConfiguration"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterLocalizationConfiguration(Commands &commands) { + using namespace chip::app::Clusters::LocalizationConfiguration; + + const char *clusterName = "LocalizationConfiguration"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeLocalizationConfigurationSupportedLocales>(), // + make_unique(), // + make_unique< + SubscribeAttributeLocalizationConfigurationGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeLocalizationConfigurationAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeLocalizationConfigurationAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeLocalizationConfigurationClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterTimeFormatLocalization(Commands & commands) -{ - using namespace chip::app::Clusters::TimeFormatLocalization; - - const char * clusterName = "TimeFormatLocalization"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterTimeFormatLocalization(Commands &commands) { + using namespace chip::app::Clusters::TimeFormatLocalization; + + const char *clusterName = "TimeFormatLocalization"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeTimeFormatLocalizationActiveCalendarType>(), // + make_unique(), // + make_unique< + SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes>(), // + make_unique(), // + make_unique< + SubscribeAttributeTimeFormatLocalizationGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeTimeFormatLocalizationAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterUnitLocalization(Commands & commands) -{ - using namespace chip::app::Clusters::UnitLocalization; - - const char * clusterName = "UnitLocalization"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterUnitLocalization(Commands &commands) { + using namespace chip::app::Clusters::UnitLocalization; + + const char *clusterName = "UnitLocalization"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterPowerSourceConfiguration(Commands & commands) -{ - using namespace chip::app::Clusters::PowerSourceConfiguration; - - const char * clusterName = "PowerSourceConfiguration"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterPowerSourceConfiguration(Commands &commands) { + using namespace chip::app::Clusters::PowerSourceConfiguration; + + const char *clusterName = "PowerSourceConfiguration"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePowerSourceConfigurationGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributePowerSourceConfigurationAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePowerSourceConfigurationClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterPowerSource(Commands & commands) -{ - using namespace chip::app::Clusters::PowerSource; - - const char * clusterName = "PowerSource"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterPowerSource(Commands &commands) { + using namespace chip::app::Clusters::PowerSource; + + const char *clusterName = "PowerSource"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePowerSourceWiredAssessedInputFrequency>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterGeneralCommissioning(Commands & commands) -{ - using namespace chip::app::Clusters::GeneralCommissioning; - - const char * clusterName = "GeneralCommissioning"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterGeneralCommissioning(Commands &commands) { + using namespace chip::app::Clusters::GeneralCommissioning; + + const char *clusterName = "GeneralCommissioning"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralCommissioningBasicCommissioningInfo>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralCommissioningLocationCapability>(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection>(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralCommissioningGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralCommissioningAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterNetworkCommissioning(Commands & commands) -{ - using namespace chip::app::Clusters::NetworkCommissioning; - - const char * clusterName = "NetworkCommissioning"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterNetworkCommissioning(Commands &commands) { + using namespace chip::app::Clusters::NetworkCommissioning; + + const char *clusterName = "NetworkCommissioning"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds>(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningLastNetworkingStatus>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningLastConnectErrorValue>(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeNetworkCommissioningAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterDiagnosticLogs(Commands & commands) -{ - using namespace chip::app::Clusters::DiagnosticLogs; - - const char * clusterName = "DiagnosticLogs"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterDiagnosticLogs(Commands &commands) { + using namespace chip::app::Clusters::DiagnosticLogs; + + const char *clusterName = "DiagnosticLogs"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterGeneralDiagnostics(Commands & commands) -{ - using namespace chip::app::Clusters::GeneralDiagnostics; - - const char * clusterName = "GeneralDiagnostics"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterGeneralDiagnostics(Commands &commands) { + using namespace chip::app::Clusters::GeneralDiagnostics; + + const char *clusterName = "GeneralDiagnostics"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralDiagnosticsTotalOperationalHours>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled>(), // + make_unique(), // + make_unique< + SubscribeAttributeGeneralDiagnosticsGeneratedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterSoftwareDiagnostics(Commands & commands) -{ - using namespace chip::app::Clusters::SoftwareDiagnostics; - - const char * clusterName = "SoftwareDiagnostics"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterSoftwareDiagnostics(Commands &commands) { + using namespace chip::app::Clusters::SoftwareDiagnostics; + + const char *clusterName = "SoftwareDiagnostics"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark>(), // + make_unique(), // + make_unique< + SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterThreadNetworkDiagnostics(Commands & commands) -{ - using namespace chip::app::Clusters::ThreadNetworkDiagnostics; - - const char * clusterName = "ThreadNetworkDiagnostics"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterThreadNetworkDiagnostics(Commands &commands) { + using namespace chip::app::Clusters::ThreadNetworkDiagnostics; + + const char *clusterName = "ThreadNetworkDiagnostics"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRouteTableList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount>(), // + make_unique< + ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount>(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount>(), // + make_unique< + ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount>(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask>(), // + make_unique< + ReadThreadNetworkDiagnosticsOperationalDatasetComponents>(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThreadNetworkDiagnosticsClusterRevision>(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterWiFiNetworkDiagnostics(Commands & commands) -{ - using namespace chip::app::Clusters::WiFiNetworkDiagnostics; - - const char * clusterName = "WiFiNetworkDiagnostics"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterWiFiNetworkDiagnostics(Commands &commands) { + using namespace chip::app::Clusters::WiFiNetworkDiagnostics; + + const char *clusterName = "WiFiNetworkDiagnostics"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterEthernetNetworkDiagnostics(Commands & commands) -{ - using namespace chip::app::Clusters::EthernetNetworkDiagnostics; - - const char * clusterName = "EthernetNetworkDiagnostics"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterEthernetNetworkDiagnostics(Commands &commands) { + using namespace chip::app::Clusters::EthernetNetworkDiagnostics; + + const char *clusterName = "EthernetNetworkDiagnostics"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBridgedDeviceBasic(Commands & commands) -{ - using namespace chip::app::Clusters::BridgedDeviceBasic; - - const char * clusterName = "BridgedDeviceBasic"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBridgedDeviceBasic(Commands &commands) { + using namespace chip::app::Clusters::BridgedDeviceBasic; + + const char *clusterName = "BridgedDeviceBasic"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBridgedDeviceBasicHardwareVersionString>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBridgedDeviceBasicSoftwareVersionString>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBridgedDeviceBasicGeneratedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterSwitch(Commands & commands) -{ - using namespace chip::app::Clusters::Switch; - - const char * clusterName = "Switch"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterSwitch(Commands &commands) { + using namespace chip::app::Clusters::Switch; + + const char *clusterName = "Switch"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterAdministratorCommissioning(Commands & commands) -{ - using namespace chip::app::Clusters::AdministratorCommissioning; - - const char * clusterName = "AdministratorCommissioning"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterAdministratorCommissioning(Commands &commands) { + using namespace chip::app::Clusters::AdministratorCommissioning; + + const char *clusterName = "AdministratorCommissioning"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique< + SubscribeAttributeAdministratorCommissioningWindowStatus>(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningAdminFabricIndex>(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningAdminVendorId>(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeAdministratorCommissioningClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOperationalCredentials(Commands & commands) -{ - using namespace chip::app::Clusters::OperationalCredentials; - - const char * clusterName = "OperationalCredentials"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOperationalCredentials(Commands &commands) { + using namespace chip::app::Clusters::OperationalCredentials; + + const char *clusterName = "OperationalCredentials"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsSupportedFabrics>(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsCommissionedFabrics>(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsTrustedRootCertificates>(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsCurrentFabricIndex>(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeOperationalCredentialsAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterGroupKeyManagement(Commands & commands) -{ - using namespace chip::app::Clusters::GroupKeyManagement; - - const char * clusterName = "GroupKeyManagement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterGroupKeyManagement(Commands &commands) { + using namespace chip::app::Clusters::GroupKeyManagement; + + const char *clusterName = "GroupKeyManagement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric>(), // + make_unique(), // + make_unique< + SubscribeAttributeGroupKeyManagementGeneratedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterFixedLabel(Commands & commands) -{ - using namespace chip::app::Clusters::FixedLabel; - - const char * clusterName = "FixedLabel"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterFixedLabel(Commands &commands) { + using namespace chip::app::Clusters::FixedLabel; + + const char *clusterName = "FixedLabel"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterUserLabel(Commands & commands) -{ - using namespace chip::app::Clusters::UserLabel; - - const char * clusterName = "UserLabel"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterUserLabel(Commands &commands) { + using namespace chip::app::Clusters::UserLabel; + + const char *clusterName = "UserLabel"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBooleanState(Commands & commands) -{ - using namespace chip::app::Clusters::BooleanState; - - const char * clusterName = "BooleanState"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBooleanState(Commands &commands) { + using namespace chip::app::Clusters::BooleanState; + + const char *clusterName = "BooleanState"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterModeSelect(Commands & commands) -{ - using namespace chip::app::Clusters::ModeSelect; - - const char * clusterName = "ModeSelect"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterModeSelect(Commands &commands) { + using namespace chip::app::Clusters::ModeSelect; + + const char *clusterName = "ModeSelect"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterDoorLock(Commands & commands) -{ - using namespace chip::app::Clusters::DoorLock; - - const char * clusterName = "DoorLock"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterDoorLock(Commands &commands) { + using namespace chip::app::Clusters::DoorLock; + + const char *clusterName = "DoorLock"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser>(), // + make_unique(), // + make_unique< + SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser>(), // + make_unique(), // + make_unique< + SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterWindowCovering(Commands & commands) -{ - using namespace chip::app::Clusters::WindowCovering; - - const char * clusterName = "WindowCovering"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterWindowCovering(Commands &commands) { + using namespace chip::app::Clusters::WindowCovering; + + const char *clusterName = "WindowCovering"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage>(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths>(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths>(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringInstalledClosedLimitLift>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeWindowCoveringInstalledClosedLimitTilt>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBarrierControl(Commands & commands) -{ - using namespace chip::app::Clusters::BarrierControl; - - const char * clusterName = "BarrierControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBarrierControl(Commands &commands) { + using namespace chip::app::Clusters::BarrierControl; + + const char *clusterName = "BarrierControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBarrierControlBarrierCommandOpenEvents>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBarrierControlBarrierCommandCloseEvents>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterPumpConfigurationAndControl(Commands & commands) -{ - using namespace chip::app::Clusters::PumpConfigurationAndControl; - - const char * clusterName = "PumpConfigurationAndControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterPumpConfigurationAndControl(Commands &commands) { + using namespace chip::app::Clusters::PumpConfigurationAndControl; + + const char *clusterName = "PumpConfigurationAndControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxPressure>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMinConstPressure>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxConstPressure>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMinCompPressure>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxCompPressure>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMinConstSpeed>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxConstSpeed>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMinConstFlow>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxConstFlow>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMinConstTemp>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlMaxConstTemp>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlEffectiveControlMode>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlOperationMode>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlControlMode>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePumpConfigurationAndControlClusterRevision>(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterThermostat(Commands & commands) -{ - using namespace chip::app::Clusters::Thermostat; - - const char * clusterName = "Thermostat"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterThermostat(Commands &commands) { + using namespace chip::app::Clusters::Thermostat; + + const char *clusterName = "Thermostat"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatTemperatureSetpointHoldDuration>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatThermostatProgrammingOperationMode>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatSetpointChangeSourceTimestamp>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterFanControl(Commands & commands) -{ - using namespace chip::app::Clusters::FanControl; - - const char * clusterName = "FanControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterFanControl(Commands &commands) { + using namespace chip::app::Clusters::FanControl; + + const char *clusterName = "FanControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterThermostatUserInterfaceConfiguration(Commands & commands) -{ - using namespace chip::app::Clusters::ThermostatUserInterfaceConfiguration; - - const char * clusterName = "ThermostatUserInterfaceConfiguration"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterThermostatUserInterfaceConfiguration(Commands &commands) { + using namespace chip::app::Clusters::ThermostatUserInterfaceConfiguration; + + const char *clusterName = "ThermostatUserInterfaceConfiguration"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique< + ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode>(), // + make_unique(Id), // + make_unique< + WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode>(), // + make_unique(Id), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout>(), // + make_unique< + ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility>(), // + make_unique< + WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility>(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility>(), // + make_unique< + ReadThermostatUserInterfaceConfigurationGeneratedCommandList>(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList>(), // + make_unique< + ReadThermostatUserInterfaceConfigurationAcceptedCommandList>(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList>(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap>(), // + make_unique(), // + make_unique< + SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterColorControl(Commands & commands) -{ - using namespace chip::app::Clusters::ColorControl; - - const char * clusterName = "ColorControl"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterColorControl(Commands &commands) { + using namespace chip::app::Clusters::ColorControl; + + const char *clusterName = "ColorControl"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeColorControlColorLoopStoredEnhancedHue>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeColorControlColorTempPhysicalMinMireds>(), // + make_unique(), // + make_unique< + SubscribeAttributeColorControlColorTempPhysicalMaxMireds>(), // + make_unique(), // + make_unique< + SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeColorControlStartUpColorTemperatureMireds>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterBallastConfiguration(Commands & commands) -{ - using namespace chip::app::Clusters::BallastConfiguration; - - const char * clusterName = "BallastConfiguration"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterBallastConfiguration(Commands &commands) { + using namespace chip::app::Clusters::BallastConfiguration; + + const char *clusterName = "BallastConfiguration"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBallastConfigurationIntrinsicBalanceFactor>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBallastConfigurationBallastFactorAdjustment>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint>(), // + make_unique(), // + make_unique< + SubscribeAttributeBallastConfigurationGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeBallastConfigurationAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterIlluminanceMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::IlluminanceMeasurement; - - const char * clusterName = "IlluminanceMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterIlluminanceMeasurement(Commands &commands) { + using namespace chip::app::Clusters::IlluminanceMeasurement; + + const char *clusterName = "IlluminanceMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeIlluminanceMeasurementMinMeasuredValue>(), // + make_unique(), // + make_unique< + SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeIlluminanceMeasurementGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeIlluminanceMeasurementAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterTemperatureMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::TemperatureMeasurement; - - const char * clusterName = "TemperatureMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterTemperatureMeasurement(Commands &commands) { + using namespace chip::app::Clusters::TemperatureMeasurement; + + const char *clusterName = "TemperatureMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeTemperatureMeasurementMinMeasuredValue>(), // + make_unique(), // + make_unique< + SubscribeAttributeTemperatureMeasurementMaxMeasuredValue>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeTemperatureMeasurementGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeTemperatureMeasurementAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterPressureMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::PressureMeasurement; - - const char * clusterName = "PressureMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterPressureMeasurement(Commands &commands) { + using namespace chip::app::Clusters::PressureMeasurement; + + const char *clusterName = "PressureMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributePressureMeasurementGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributePressureMeasurementAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterFlowMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::FlowMeasurement; - - const char * clusterName = "FlowMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterFlowMeasurement(Commands &commands) { + using namespace chip::app::Clusters::FlowMeasurement; + + const char *clusterName = "FlowMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterRelativeHumidityMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::RelativeHumidityMeasurement; - - const char * clusterName = "RelativeHumidityMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterRelativeHumidityMeasurement(Commands &commands) { + using namespace chip::app::Clusters::RelativeHumidityMeasurement; + + const char *clusterName = "RelativeHumidityMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementMeasuredValue>(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue>(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementAttributeList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeRelativeHumidityMeasurementClusterRevision>(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterOccupancySensing(Commands & commands) -{ - using namespace chip::app::Clusters::OccupancySensing; - - const char * clusterName = "OccupancySensing"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterOccupancySensing(Commands &commands) { + using namespace chip::app::Clusters::OccupancySensing; + + const char *clusterName = "OccupancySensing"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOccupancySensingPirOccupiedToUnoccupiedDelay>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedDelay>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeOccupancySensingPirUnoccupiedToOccupiedThreshold>(), // + make_unique(), // + make_unique< + WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay>(), // + make_unique< + SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay>(), // + make_unique(), // + make_unique< + WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay>(), // + make_unique< + SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay>(), // + make_unique< + ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold>(), // + make_unique< + WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold>(), // + make_unique< + SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold>(), // + make_unique< + ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay>(), // + make_unique< + WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay>(), // + make_unique< + SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay>(), // + make_unique< + ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay>(), // + make_unique< + WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay>(), // + make_unique< + SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay>(), // + make_unique< + ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold>(), // + make_unique< + WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold>(), // + make_unique< + SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterWakeOnLan(Commands & commands) -{ - using namespace chip::app::Clusters::WakeOnLan; - - const char * clusterName = "WakeOnLan"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterWakeOnLan(Commands &commands) { + using namespace chip::app::Clusters::WakeOnLan; + + const char *clusterName = "WakeOnLan"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterChannel(Commands & commands) -{ - using namespace chip::app::Clusters::Channel; - - const char * clusterName = "Channel"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterChannel(Commands &commands) { + using namespace chip::app::Clusters::Channel; + + const char *clusterName = "Channel"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterTargetNavigator(Commands & commands) -{ - using namespace chip::app::Clusters::TargetNavigator; - - const char * clusterName = "TargetNavigator"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterTargetNavigator(Commands &commands) { + using namespace chip::app::Clusters::TargetNavigator; + + const char *clusterName = "TargetNavigator"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterMediaPlayback(Commands & commands) -{ - using namespace chip::app::Clusters::MediaPlayback; - - const char * clusterName = "MediaPlayback"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterMediaPlayback(Commands &commands) { + using namespace chip::app::Clusters::MediaPlayback; + + const char *clusterName = "MediaPlayback"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterMediaInput(Commands & commands) -{ - using namespace chip::app::Clusters::MediaInput; - - const char * clusterName = "MediaInput"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterMediaInput(Commands &commands) { + using namespace chip::app::Clusters::MediaInput; + + const char *clusterName = "MediaInput"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterLowPower(Commands & commands) -{ - using namespace chip::app::Clusters::LowPower; - - const char * clusterName = "LowPower"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterLowPower(Commands &commands) { + using namespace chip::app::Clusters::LowPower; + + const char *clusterName = "LowPower"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterKeypadInput(Commands & commands) -{ - using namespace chip::app::Clusters::KeypadInput; - - const char * clusterName = "KeypadInput"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterKeypadInput(Commands &commands) { + using namespace chip::app::Clusters::KeypadInput; + + const char *clusterName = "KeypadInput"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterContentLauncher(Commands & commands) -{ - using namespace chip::app::Clusters::ContentLauncher; - - const char * clusterName = "ContentLauncher"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterContentLauncher(Commands &commands) { + using namespace chip::app::Clusters::ContentLauncher; + + const char *clusterName = "ContentLauncher"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeContentLauncherSupportedStreamingProtocols>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterAudioOutput(Commands & commands) -{ - using namespace chip::app::Clusters::AudioOutput; - - const char * clusterName = "AudioOutput"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterAudioOutput(Commands &commands) { + using namespace chip::app::Clusters::AudioOutput; + + const char *clusterName = "AudioOutput"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterApplicationLauncher(Commands & commands) -{ - using namespace chip::app::Clusters::ApplicationLauncher; - - const char * clusterName = "ApplicationLauncher"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterApplicationLauncher(Commands &commands) { + using namespace chip::app::Clusters::ApplicationLauncher; + + const char *clusterName = "ApplicationLauncher"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeApplicationLauncherGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeApplicationLauncherAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterApplicationBasic(Commands & commands) -{ - using namespace chip::app::Clusters::ApplicationBasic; - - const char * clusterName = "ApplicationBasic"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterApplicationBasic(Commands &commands) { + using namespace chip::app::Clusters::ApplicationBasic; + + const char *clusterName = "ApplicationBasic"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterAccountLogin(Commands & commands) -{ - using namespace chip::app::Clusters::AccountLogin; - - const char * clusterName = "AccountLogin"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterAccountLogin(Commands &commands) { + using namespace chip::app::Clusters::AccountLogin; + + const char *clusterName = "AccountLogin"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterElectricalMeasurement(Commands & commands) -{ - using namespace chip::app::Clusters::ElectricalMeasurement; - - const char * clusterName = "ElectricalMeasurement"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterElectricalMeasurement(Commands &commands) { + using namespace chip::app::Clusters::ElectricalMeasurement; + + const char *clusterName = "ElectricalMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementDcVoltageMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementDcCurrentMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementDcPowerMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementTotalReactivePower>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementTotalApparentPower>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured1stHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured3rdHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured5thHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured7thHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured9thHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasured11thHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase1stHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase1stHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase3rdHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase3rdHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase5thHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase5thHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase7thHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase7thHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase9thHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase9thHarmonicCurrent>(), // + make_unique< + ReadElectricalMeasurementMeasuredPhase11thHarmonicCurrent>(), // + make_unique< + SubscribeAttributeElectricalMeasurementMeasuredPhase11thHarmonicCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcFrequencyMultiplier>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcFrequencyDivisor>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementHarmonicCurrentMultiplier>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementPhaseHarmonicCurrentMultiplier>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementInstantaneousVoltage>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementInstantaneousLineCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementInstantaneousActiveCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementInstantaneousReactiveCurrent>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementInstantaneousPower>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriod>(), // + make_unique< + WriteElectricalMeasurementAverageRmsVoltageMeasurementPeriod>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriod>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounter>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriod>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriod>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriod>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriod>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcVoltageMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcCurrentMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcPowerMultiplier>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementOverloadAlarmsMask>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcOverloadAlarmsMask>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcVoltageOverload>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcCurrentOverload>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcActivePowerOverload>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcReactivePowerOverload>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltage>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltage>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltage>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltage>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementLineCurrentPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActiveCurrentPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseB>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseB>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerMinPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementReactivePowerPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementApparentPowerPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementPowerFactorPhaseB>(), // + make_unique< + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseB>(), // + make_unique< + ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseB>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseB>(), // + make_unique< + ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseB>(), // + make_unique< + ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB>(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseB>(), // + make_unique< + ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB>(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseB>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementLineCurrentPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActiveCurrentPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementReactiveCurrentPhaseC>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageMinPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageMaxPhaseC>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsCurrentMinPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsCurrentMaxPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerMinPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementActivePowerMaxPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementReactivePowerPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementApparentPowerPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementPowerFactorPhaseC>(), // + make_unique< + ReadElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsVoltageMeasurementPeriodPhaseC>(), // + make_unique< + ReadElectricalMeasurementAverageRmsOverVoltageCounterPhaseC>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsOverVoltageCounterPhaseC>(), // + make_unique< + ReadElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC>(), // + make_unique< + SubscribeAttributeElectricalMeasurementAverageRmsUnderVoltageCounterPhaseC>(), // + make_unique< + ReadElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC>(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeOverVoltagePeriodPhaseC>(), // + make_unique< + ReadElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC>(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsExtremeUnderVoltagePeriodPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSagPeriodPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementRmsVoltageSwellPeriodPhaseC>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementGeneratedCommandList>(), // + make_unique(), // + make_unique< + SubscribeAttributeElectricalMeasurementAcceptedCommandList>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterUnitTesting(Commands & commands) -{ - using namespace chip::app::Clusters::UnitTesting; - - const char * clusterName = "UnitTesting"; - - commands_list clusterCommands = { - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; - - commands.Register(clusterName, clusterCommands); +void registerClusterUnitTesting(Commands &commands) { + using namespace chip::app::Clusters::UnitTesting; + + const char *clusterName = "UnitTesting"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u>(), // + make_unique(), // + make_unique(), // + make_unique< + SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s>(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + }; + + commands.Register(clusterName, clusterCommands); } -void registerClusterAny(Commands & commands) -{ - const char * clusterName = "Any"; +void registerClusterAny(Commands &commands) { + const char *clusterName = "Any"; - commands_list clusterCommands = { - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - }; + commands_list clusterCommands = { + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; - commands.Register(clusterName, clusterCommands); + commands.Register(clusterName, clusterCommands); } -void registerClusters(Commands & commands) -{ - registerClusterAny(commands); - registerClusterIdentify(commands); - registerClusterGroups(commands); - registerClusterScenes(commands); - registerClusterOnOff(commands); - registerClusterOnOffSwitchConfiguration(commands); - registerClusterLevelControl(commands); - registerClusterBinaryInputBasic(commands); - registerClusterDescriptor(commands); - registerClusterBinding(commands); - registerClusterAccessControl(commands); - registerClusterActions(commands); - registerClusterBasicInformation(commands); - registerClusterOtaSoftwareUpdateProvider(commands); - registerClusterOtaSoftwareUpdateRequestor(commands); - registerClusterLocalizationConfiguration(commands); - registerClusterTimeFormatLocalization(commands); - registerClusterUnitLocalization(commands); - registerClusterPowerSourceConfiguration(commands); - registerClusterPowerSource(commands); - registerClusterGeneralCommissioning(commands); - registerClusterNetworkCommissioning(commands); - registerClusterDiagnosticLogs(commands); - registerClusterGeneralDiagnostics(commands); - registerClusterSoftwareDiagnostics(commands); - registerClusterThreadNetworkDiagnostics(commands); - registerClusterWiFiNetworkDiagnostics(commands); - registerClusterEthernetNetworkDiagnostics(commands); - registerClusterBridgedDeviceBasic(commands); - registerClusterSwitch(commands); - registerClusterAdministratorCommissioning(commands); - registerClusterOperationalCredentials(commands); - registerClusterGroupKeyManagement(commands); - registerClusterFixedLabel(commands); - registerClusterUserLabel(commands); - registerClusterBooleanState(commands); - registerClusterModeSelect(commands); - registerClusterDoorLock(commands); - registerClusterWindowCovering(commands); - registerClusterBarrierControl(commands); - registerClusterPumpConfigurationAndControl(commands); - registerClusterThermostat(commands); - registerClusterFanControl(commands); - registerClusterThermostatUserInterfaceConfiguration(commands); - registerClusterColorControl(commands); - registerClusterBallastConfiguration(commands); - registerClusterIlluminanceMeasurement(commands); - registerClusterTemperatureMeasurement(commands); - registerClusterPressureMeasurement(commands); - registerClusterFlowMeasurement(commands); - registerClusterRelativeHumidityMeasurement(commands); - registerClusterOccupancySensing(commands); - registerClusterWakeOnLan(commands); - registerClusterChannel(commands); - registerClusterTargetNavigator(commands); - registerClusterMediaPlayback(commands); - registerClusterMediaInput(commands); - registerClusterLowPower(commands); - registerClusterKeypadInput(commands); - registerClusterContentLauncher(commands); - registerClusterAudioOutput(commands); - registerClusterApplicationLauncher(commands); - registerClusterApplicationBasic(commands); - registerClusterAccountLogin(commands); - registerClusterElectricalMeasurement(commands); - registerClusterUnitTesting(commands); -} \ No newline at end of file +void registerClusters(Commands &commands) { + registerClusterAny(commands); + registerClusterIdentify(commands); + registerClusterGroups(commands); + registerClusterScenes(commands); + registerClusterOnOff(commands); + registerClusterOnOffSwitchConfiguration(commands); + registerClusterLevelControl(commands); + registerClusterBinaryInputBasic(commands); + registerClusterDescriptor(commands); + registerClusterBinding(commands); + registerClusterAccessControl(commands); + registerClusterActions(commands); + registerClusterBasicInformation(commands); + registerClusterOtaSoftwareUpdateProvider(commands); + registerClusterOtaSoftwareUpdateRequestor(commands); + registerClusterLocalizationConfiguration(commands); + registerClusterTimeFormatLocalization(commands); + registerClusterUnitLocalization(commands); + registerClusterPowerSourceConfiguration(commands); + registerClusterPowerSource(commands); + registerClusterGeneralCommissioning(commands); + registerClusterNetworkCommissioning(commands); + registerClusterDiagnosticLogs(commands); + registerClusterGeneralDiagnostics(commands); + registerClusterSoftwareDiagnostics(commands); + registerClusterThreadNetworkDiagnostics(commands); + registerClusterWiFiNetworkDiagnostics(commands); + registerClusterEthernetNetworkDiagnostics(commands); + registerClusterBridgedDeviceBasic(commands); + registerClusterSwitch(commands); + registerClusterAdministratorCommissioning(commands); + registerClusterOperationalCredentials(commands); + registerClusterGroupKeyManagement(commands); + registerClusterFixedLabel(commands); + registerClusterUserLabel(commands); + registerClusterBooleanState(commands); + registerClusterModeSelect(commands); + registerClusterDoorLock(commands); + registerClusterWindowCovering(commands); + registerClusterBarrierControl(commands); + registerClusterPumpConfigurationAndControl(commands); + registerClusterThermostat(commands); + registerClusterFanControl(commands); + registerClusterThermostatUserInterfaceConfiguration(commands); + registerClusterColorControl(commands); + registerClusterBallastConfiguration(commands); + registerClusterIlluminanceMeasurement(commands); + registerClusterTemperatureMeasurement(commands); + registerClusterPressureMeasurement(commands); + registerClusterFlowMeasurement(commands); + registerClusterRelativeHumidityMeasurement(commands); + registerClusterOccupancySensing(commands); + registerClusterWakeOnLan(commands); + registerClusterChannel(commands); + registerClusterTargetNavigator(commands); + registerClusterMediaPlayback(commands); + registerClusterMediaInput(commands); + registerClusterLowPower(commands); + registerClusterKeypadInput(commands); + registerClusterContentLauncher(commands); + registerClusterAudioOutput(commands); + registerClusterApplicationLauncher(commands); + registerClusterApplicationBasic(commands); + registerClusterAccountLogin(commands); + registerClusterElectricalMeasurement(commands); + registerClusterUnitTesting(commands); +}