Skip to content

Commit

Permalink
Fix a few issues with subscriptions in darwin-framework-tool. (#23560)
Browse files Browse the repository at this point in the history
1) When doing a "clustername subscribe attributename", the optional
   --autoResubscribe argument was ignored (so auto-resubscribe) was always
   enabled.  The change in templates/commands.zapt fixes that.

2) When running YAML tests in darwin-framework-tool, the "fabricFiltered" and
   "keepSubscriptions" annotations in the YAML were ignoring, defaulting to
   "true" and "false" respectively.  The change in
   templates/tests/partials/test_cluster.zapt fixes that.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 1, 2023
1 parent 1f02dc3 commit 1030020
Show file tree
Hide file tree
Showing 4 changed files with 3,278 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/darwin-framework-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ public:
if (mFabricFiltered.HasValue()) {
params.filterByFabric = mFabricFiltered.Value();
}
if (mAutoResubscribe.HasValue()) {
params.resubscribeIfLost = mAutoResubscribe.Value();
}
[cluster subscribe{{>attribute}}WithParams:params
subscriptionEstablished:^(){ mSubscriptionEstablished=YES; }
reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class {{filename}}: public TestCommandBridge
{{asObjectiveCBasicType type}} {{asLowerCamelCase name}}Argument = {{asTypedLiteral definedValue type}};
{{/chip_tests_item_parameters}}
MTRSubscribeParams * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) maxInterval:@(maxIntervalArgument)];
params.filterByFabric = {{#if fabricFiltered}}true{{else}}false{{/if}};
params.replaceExistingSubscriptions = {{#if keepSubscriptions}}false{{else}}true{{/if}};
[cluster subscribeAttribute{{asUpperCamelCase attribute}}WithParams:params
subscriptionEstablished:^{
VerifyOrReturn(testSendCluster{{parent.filename}}_{{waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE));
Expand Down
Loading

0 comments on commit 1030020

Please sign in to comment.