-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that MTRDevice invokes provide a timed invoke timeout when nee…
…ded. (#29855) (#29871) If we know the command being invoked needs a timed invoke, and the caller did not provide a timed invoke timeout, go ahead and use a default one.
- Loading branch information
1 parent
4279e11
commit 1176530
Showing
13 changed files
with
1,445 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
BOOL MTRCommandNeedsTimedInvoke(NSNumber * aClusterID, NSNumber * aCommandID); | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/darwin/Framework/CHIP/templates/MTRCommandTimedCheck-src.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{> header excludeZapComment=true}} | ||
|
||
#import "MTRCommandTimedCheck.h" | ||
|
||
#include <app-common/zap-generated/ids/Commands.h> | ||
#include <app-common/zap-generated/ids/Clusters.h> | ||
|
||
using namespace chip; | ||
using namespace chip::app; | ||
|
||
{{#zcl_clusters}} | ||
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} | ||
static BOOL CommandNeedsTimedInvokeIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(AttributeId aAttributeId) | ||
{ | ||
using namespace Clusters::{{asUpperCamelCase name}}; | ||
switch (aAttributeId) { | ||
{{#zcl_commands}} | ||
{{#if (and (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) | ||
mustUseTimedInvoke)}} | ||
case Commands::{{asUpperCamelCase name}}::Id: { | ||
return YES; | ||
} | ||
{{/if}} | ||
{{/zcl_commands}} | ||
default: { | ||
return NO; | ||
} | ||
} | ||
} | ||
{{/if}} | ||
{{/zcl_clusters}} | ||
|
||
BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonnull aCommandID) | ||
{ | ||
ClusterId clusterID = static_cast<ClusterId>(aClusterID.unsignedLongLongValue); | ||
CommandId commandID = static_cast<CommandId>(aCommandID.unsignedLongLongValue); | ||
|
||
switch (clusterID) | ||
{ | ||
{{#zcl_clusters}} | ||
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} | ||
case Clusters::{{asUpperCamelCase name}}::Id: { | ||
return CommandNeedsTimedInvokeIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(commandID); | ||
} | ||
{{/if}} | ||
{{/zcl_clusters}} | ||
default: { | ||
return NO; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.