diff --git a/examples/chip-tool-darwin/templates/commands.zapt b/examples/chip-tool-darwin/templates/commands.zapt index 9355d72c0b6a5c..66b97aebb9bdeb 100644 --- a/examples/chip-tool-darwin/templates/commands.zapt +++ b/examples/chip-tool-darwin/templates/commands.zapt @@ -207,7 +207,6 @@ private: {{/unless}} {{/if}} -{{#unless (isStrEqual chipCallback.name "Unsupported")}} {{#if isReportableAttribute}} class SubscribeAttribute{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand { @@ -254,7 +253,6 @@ private: }; {{/if}} -{{/unless}} {{/chip_server_cluster_attributes}} {{/chip_client_clusters}} @@ -272,7 +270,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} {{! TODO: Various types (floats, structs) not supported here. }} - {{#unless (isStrEqual chipCallback.name "Unsupported")}} make_unique(), // {{#if isWritableAttribute}} {{! No list support for writing yet. Need to figure out how to @@ -284,7 +281,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{#if isReportableAttribute}} make_unique(), // {{/if}} - {{/unless}} {{/chip_server_cluster_attributes}} }; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index 75df474bd97069..610f0d56a7f960 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -2122,6 +2122,53 @@ class ReadApplicationBasicApplication : public ModelCommand { } }; +class SubscribeAttributeApplicationBasicApplication : public ModelCommand { +public: + SubscribeAttributeApplicationBasicApplication() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "application"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeApplicationBasicApplication() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPApplicationBasic * cluster = [[CHIPApplicationBasic alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeApplicationWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPApplicationBasicClusterApplicationBasicApplication * _Nullable value, + NSError * _Nullable error) { + NSLog(@"ApplicationBasic.Application response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute Status */ @@ -2958,6 +3005,52 @@ class WriteApplicationLauncherCurrentApp : public ModelCommand { private: }; +class SubscribeAttributeApplicationLauncherCurrentApp : public ModelCommand { +public: + SubscribeAttributeApplicationLauncherCurrentApp() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "current-app"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeApplicationLauncherCurrentApp() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPApplicationLauncher * cluster = [[CHIPApplicationLauncher alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeCurrentAppWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPApplicationLauncherClusterApplicationEP * _Nullable value, + NSError * _Nullable error) { + NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute GeneratedCommandList */ @@ -10660,6 +10753,50 @@ class ReadChannelLineup : public ModelCommand { } }; +class SubscribeAttributeChannelLineup : public ModelCommand { +public: + SubscribeAttributeChannelLineup() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "lineup"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeChannelLineup() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPChannel * cluster = [[CHIPChannel alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeLineupWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPChannelClusterLineupInfo * _Nullable value, NSError * _Nullable error) { + NSLog(@"Channel.Lineup response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentChannel */ @@ -10693,6 +10830,50 @@ class ReadChannelCurrentChannel : public ModelCommand { } }; +class SubscribeAttributeChannelCurrentChannel : public ModelCommand { +public: + SubscribeAttributeChannelCurrentChannel() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "current-channel"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeChannelCurrentChannel() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000002) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPChannel * cluster = [[CHIPChannel alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeCurrentChannelWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + CHIPChannelClusterChannelInfo * _Nullable value, NSError * _Nullable error) { + NSLog(@"Channel.CurrentChannel response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute GeneratedCommandList */ @@ -25387,6 +25568,55 @@ class ReadGeneralCommissioningBasicCommissioningInfo : public ModelCommand { } }; +class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo : public ModelCommand { +public: + SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "basic-commissioning-info"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPGeneralCommissioning * cluster = [[CHIPGeneralCommissioning alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeBasicCommissioningInfoWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + CHIPGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, + NSError * _Nullable error) { + NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", + [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RegulatoryConfig */ @@ -34034,6 +34264,50 @@ class ReadMediaPlaybackSampledPosition : public ModelCommand { } }; +class SubscribeAttributeMediaPlaybackSampledPosition : public ModelCommand { +public: + SubscribeAttributeMediaPlaybackSampledPosition() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "sampled-position"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeMediaPlaybackSampledPosition() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000003) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPMediaPlayback * cluster = [[CHIPMediaPlayback alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeSampledPositionWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPMediaPlaybackClusterPlaybackPosition * _Nullable value, + NSError * _Nullable error) { + NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute PlaybackSpeed */ @@ -54237,6 +54511,50 @@ class WriteTestClusterStructAttr : public ModelCommand { private: }; +class SubscribeAttributeTestClusterStructAttr : public ModelCommand { +public: + SubscribeAttributeTestClusterStructAttr() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "struct-attr"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeTestClusterStructAttr() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00000025) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeStructAttrWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, + NSError * _Nullable error) { + NSLog(@"TestCluster.StructAttr response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RangeRestrictedInt8u */ @@ -58401,6 +58719,50 @@ class WriteTestClusterNullableStruct : public ModelCommand { private: }; +class SubscribeAttributeTestClusterNullableStruct : public ModelCommand { +public: + SubscribeAttributeTestClusterNullableStruct() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "nullable-struct"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeTestClusterNullableStruct() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008025) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeNullableStructWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, + NSError * _Nullable error) { + NSLog(@"TestCluster.NullableStruct response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute NullableRangeRestrictedInt8u */ @@ -72784,6 +73146,8 @@ void registerClusterApplicationBasic(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -72812,6 +73176,9 @@ void registerClusterApplicationLauncher(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73088,6 +73455,10 @@ void registerClusterChannel(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73556,6 +73927,8 @@ void registerClusterGeneralCommissioning(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73876,6 +74249,8 @@ void registerClusterMediaPlayback(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -74558,6 +74933,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -74670,6 +75048,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), //