-
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.
Update cluster command APIs to make it easier to fix list/struct supp…
…ort in commands (#10168) * Put in place codegen infrastructure for better cluster callback API. Specific changes: 1) Codegen skeleton (empty so far) structs that represent command fields. 2) Modify codegen to pass the command path and the field struct to a command callback and change the order of the endpoint and CommandSender/CommandHandler arguments. 3) Modify codegen implementation of callbacks to have the new signature. ./scripts/tools/zap/generate.py -t src/app/common/templates/templates.json -o zzz_generated/app-common/app-common/zap-generated src/controller/data_model/controller-clusters.zap && ./scripts/tools/zap/generate.py -o zzz_generated/all-clusters-app/zap-generated examples/all-clusters-app/all-clusters-common/all-clusters-app.zap && ./gn_build.sh * Regenerate generated files * Update cluster callback signatures to the new signature. This commit was generated by running: find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/bool emberAf([a-zA-Z0-9]*)Cluster([a-zA-Z0-9]*)Callback\((?:chip::)?EndpointId (aEndpoint|endpoint|aEndpointId),\s*(?:chip::)?((?:app::)?CommandHandler \*(?: commandObj| command| apCommandObj|))([^)]*)\)/bool emberAf\1Cluster\2Callback(\4, const app::ConcreteCommandPath & commandPath, EndpointId \3\5, Commands::\2::DecodableType & commandData)/g;' and then restyling the modified files. * Manual changes to make clusters compile. Mostly: * Include headers needed for ConcreteCommandPath and the command field structs. * Make sure the namespaces are done right (add using declarations or namespace prefixes as needed). * Resolve some name ambiguities due to name collisions between cluster-objects.h and af-structs.h. We need to find a better solution for this.
- Loading branch information
1 parent
2f7868b
commit 1327178
Showing
58 changed files
with
9,072 additions
and
3,609 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 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 | ||
|
||
#include <app/util/basic-types.h> | ||
#include <lib/core/Optional.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
|
||
/** | ||
* A representation of a concrete invoke path. | ||
*/ | ||
struct ConcreteCommandPath | ||
{ | ||
ConcreteCommandPath(EndpointId aEndpointId, ClusterId aClusterId, CommandId aCommandId) : | ||
mEndpointId(aEndpointId), mClusterId(aClusterId), mCommandId(aCommandId) | ||
{} | ||
|
||
const EndpointId mEndpointId = 0; | ||
const ClusterId mClusterId = 0; | ||
const CommandId mCommandId = 0; | ||
}; | ||
} // namespace app | ||
} // namespace chip |
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
Oops, something went wrong.